mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-22 16:28:28 +00:00
Compare commits
224 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0ebc7f9bb6 | |||
| 9ac25338bb | |||
| e9285fd2ca | |||
| 5b85f89c21 | |||
| 7fed8fc8c8 | |||
| 26769f40d9 | |||
| f6148b9b8d | |||
| ca1299bf1d | |||
| 3fb24dc0a3 | |||
| dcd7bffa54 | |||
| 5298abe6bc | |||
| fbc2b7c152 | |||
| 86705000b0 | |||
| 748e37dbdf | |||
| 27256215b8 | |||
| 59cbe1a152 | |||
| 3e50427bb7 | |||
| 883b3b5826 | |||
| 135ee6b2b7 | |||
| 906879ce2e | |||
| 8b7aba2769 | |||
| 9303255caa | |||
| 14509fcc4e | |||
| e40267b9b8 | |||
| f3073b463f | |||
| 5ad4129312 | |||
| 4b5b29b165 | |||
| 3b7a138de4 | |||
| 742b437f2c | |||
| d41bd8f963 | |||
| 73a099c5ea | |||
| 77c0eb3998 | |||
| 5d1c59c95f | |||
| 1d7f39c13b | |||
| 1bb8678abe | |||
| 47968774d9 | |||
| d7dc717249 | |||
| 32659426ba | |||
| 238c9fe667 | |||
| b9f997015a | |||
| 11e2a252e5 | |||
| fc627ed52d | |||
| 4c028b85f0 | |||
| f1d5e3eedf | |||
| d59531b16f | |||
| e182d685d3 | |||
| 6968a70310 | |||
| 06e8d258e4 | |||
| 8cb15f9357 | |||
| eb33e5a064 | |||
| 71f78b757e | |||
| 818f833d04 | |||
| 1238a6ca68 | |||
| 4afc1efb38 | |||
| 24eb40d231 | |||
| 2475092ed9 | |||
| 53d6e449c2 | |||
| b61649a2a0 | |||
| ef635cb257 | |||
| 62b5f8a488 | |||
| d0e069f4f8 | |||
| 1b5b22eeca | |||
| 66d9371714 | |||
| 0418dc4aa3 | |||
| f12c87a04a | |||
| 97dbf85a4c | |||
| 46a0cf6b02 | |||
| 8f34bd998f | |||
| 98928aee74 | |||
| e6dc980315 | |||
| ec465616b4 | |||
| 23de0119ff | |||
| f59b4feb94 | |||
| e035660150 | |||
| 472dd71d7f | |||
| 409b6bf424 | |||
| 9da713a830 | |||
| 7d194083aa | |||
| dd41fc5fcd | |||
| 6bf36f3e77 | |||
| dfb06db17b | |||
| 3e958c575b | |||
| e5db19965f | |||
| ce73f6bfe1 | |||
| 700f4645e2 | |||
| 5a7d544c5b | |||
| 0f7f71334a | |||
| c731f3f560 | |||
| b30fbc70a3 | |||
| 195cb80d56 | |||
| b2d5007466 | |||
| 47e2eb0acf | |||
| c36b3f030b | |||
| 2b821e50ff | |||
| 0aa07e9529 | |||
| 7ddafd9ed8 | |||
| 5488e9bf22 | |||
| 6db6d7dca9 | |||
| 066b762e73 | |||
| cd85a8524a | |||
| 4490a53ba0 | |||
| 00eb462d47 | |||
| 2df7d19f97 | |||
| 48c6db3a9c | |||
| cce368d94c | |||
| 84b8bdd2b4 | |||
| fc8ace91cb | |||
| 2d6c9f881a | |||
| 9b72c07a54 | |||
| 9d5d13fbd0 | |||
| bc3e9e8fba | |||
| d9cfc3a858 | |||
| 51dc62dfb1 | |||
| e52e4d5b3f | |||
| 0c3149a6e5 | |||
| 611122833d | |||
| b83373491e | |||
| dfa349492c | |||
| c08200188f | |||
| 41d9a15c74 | |||
| 2ed4effbe3 | |||
| 6ec09f300a | |||
| 079f612730 | |||
| 2c971fb2de | |||
| 20e9a8b2d2 | |||
| 8fa6a0b496 | |||
| d6e1c3f187 | |||
| 70a4b6a2b1 | |||
| 7923d7bc6c | |||
| 6007ba454c | |||
| d4a78f4799 | |||
| 0ada53aa96 | |||
| 7803170d6b | |||
| 20778ad7d9 | |||
| 44d63c47d9 | |||
| b288202c96 | |||
| a724e92638 | |||
| 0ea825e9a4 | |||
| 2ca50b339d | |||
| 164fe31fa8 | |||
| f3de3e8c31 | |||
| 1227f35382 | |||
| c0769a9c29 | |||
| 2dd0e51936 | |||
| fd787af53a | |||
| aa39ac8023 | |||
| 397096996c | |||
| f8de9b9167 | |||
| 9d48cbcd29 | |||
| eb5eb0ca30 | |||
| bc4bebb4a9 | |||
| 05f09b56e6 | |||
| 411fe3d95d | |||
| c1e984dfc1 | |||
| a5d9a8596a | |||
| 7e23d798d5 | |||
| 47ab8910a3 | |||
| 259add68f5 | |||
| d2f5dc43a6 | |||
| 99d2e3a8b1 | |||
| 122fe398b4 | |||
| 43c4b13978 | |||
| a3a707adae | |||
| c4da9766a4 | |||
| a8eb2832ce | |||
| 076aab50e8 | |||
| 1e8889a9fc | |||
| 7c3481daf9 | |||
| b93dec357f | |||
| 2f4af4f0c2 | |||
| a0f2a8a743 | |||
| 4c7016bd7b | |||
| 6c18cd0bee | |||
| 87e63e1e36 | |||
| a771882cff | |||
| b3f6a8c55f | |||
| 605502cd9d | |||
| 4712ca471b | |||
| 836c3d6596 | |||
| 53169ae217 | |||
| fd31915fae | |||
| 52763b6dd2 | |||
| 51cd43b4ea | |||
| 2db84f5a4f | |||
| 79cc2d5351 | |||
| d31cb09214 | |||
| 8bedcd8751 | |||
| 473c5096f6 | |||
| 0b181d5048 | |||
| a7e9af2d27 | |||
| 7a72d5d67e | |||
| 25872203ff | |||
| 6396a6fbef | |||
| 6db0a5c3f0 | |||
| 4fa9e1d66f | |||
| 556af8c5e9 | |||
| f3ef8a0993 | |||
| 267c280db8 | |||
| e06c7d7735 | |||
| 028ebc3a0c | |||
| b3bd44cd76 | |||
| 75a627a3a2 | |||
| 0194aedc92 | |||
| 5cc87cbda7 | |||
| 703862d977 | |||
| 6e325c1ee3 | |||
| 933b83add6 | |||
| b3cd4e63f1 | |||
| 3c894cb533 | |||
| b19ad64800 | |||
| 2cd3d27c67 | |||
| d3b46becd0 | |||
| 286479198f | |||
| 21ec832ca6 | |||
| bdf5f8b4a3 | |||
| 4ca6485398 | |||
| 0c9c2e25c1 | |||
| 7e651877c7 | |||
| 9739c1c8ef | |||
| 8aae59eebe | |||
| c1b07afae9 | |||
| 9c238cd08d | |||
| 33adb9bcc1 | |||
| 2e8bf82861 |
+1
-1
@@ -15,7 +15,7 @@ volumes:
|
||||
|
||||
steps:
|
||||
- name: Build Linux X64
|
||||
image: akkadius/eqemu-server:v13
|
||||
image: akkadius/eqemu-server:v14
|
||||
environment:
|
||||
GITHUB_TOKEN:
|
||||
from_secret: GH_RELEASE_GITHUB_API_TOKEN
|
||||
|
||||
+502
@@ -1,3 +1,505 @@
|
||||
## [22.43.2] - 1/25/2024
|
||||
|
||||
### Bots
|
||||
|
||||
* ^mez command spell list fix ([#3998](https://github.com/EQEmu/Server/pull/3998)) @dariusuknuis 2024-01-19
|
||||
|
||||
### Code
|
||||
|
||||
* Cleanup position methods ([#4015](https://github.com/EQEmu/Server/pull/4015)) @Kinglykrab 2024-01-25
|
||||
|
||||
### Commands
|
||||
|
||||
* Add `#npcedit set_grid [Grid ID]` to `#npcedit` ([#4004](https://github.com/EQEmu/Server/pull/4004)) @Kinglykrab 2024-01-22
|
||||
|
||||
### Crash Fix
|
||||
|
||||
* Fix crash when creating Frogloks/Drakkin ([#4016](https://github.com/EQEmu/Server/pull/4016)) @Kinglykrab 2024-01-25
|
||||
* Reverting PR #3877 ([#3997](https://github.com/EQEmu/Server/pull/3997)) @fryguy503 2024-01-17
|
||||
|
||||
### Database
|
||||
|
||||
* Drop deprecated item_tick table ([#3977](https://github.com/EQEmu/Server/pull/3977)) @Akkadius 2024-01-14
|
||||
* Drop item_tick if exists tweak in manifest ([#3985](https://github.com/EQEmu/Server/pull/3985)) @Akkadius 2024-01-15
|
||||
* Increase max spawngroup name from 50 to 200 ([#3991](https://github.com/EQEmu/Server/pull/3991)) @Akkadius 2024-01-22
|
||||
|
||||
### Fixes
|
||||
|
||||
* Fix Mercenaries Buffs/Zoning Issues ([#4000](https://github.com/EQEmu/Server/pull/4000)) @Kinglykrab 2024-01-22
|
||||
* Fix zone database update manifest ([#3972](https://github.com/EQEmu/Server/pull/3972)) @Kinglykrab 2024-01-13
|
||||
* Fixes to zone idle while empty changes. ([#4006](https://github.com/EQEmu/Server/pull/4006)) @noudess 2024-01-23
|
||||
* Reversed logic on InLiquid ([#3979](https://github.com/EQEmu/Server/pull/3979)) @fryguy503 2024-01-14
|
||||
|
||||
### Instances
|
||||
|
||||
* Convert Instance Quest Methods to Repositories ([#4012](https://github.com/EQEmu/Server/pull/4012)) @Kinglykrab 2024-01-25
|
||||
|
||||
### Logging
|
||||
|
||||
* Force Info category to be always on in file/console logs ([#3990](https://github.com/EQEmu/Server/pull/3990)) @Akkadius 2024-01-22
|
||||
|
||||
### Merchants
|
||||
|
||||
* Change database structure for merchant slots ([#3974](https://github.com/EQEmu/Server/pull/3974)) @joligario 2024-01-14
|
||||
|
||||
### Messages
|
||||
|
||||
* Fix disciple message added by previous patch. ([#3986](https://github.com/EQEmu/Server/pull/3986)) @noudess 2024-01-15
|
||||
|
||||
### Quest API
|
||||
|
||||
* QuestReward should now summon item to the inventory instead of the cursor. ([#3996](https://github.com/EQEmu/Server/pull/3996)) @regneq 2024-01-22
|
||||
|
||||
### Repositories
|
||||
|
||||
* Add `rank` to reserved words ([#3982](https://github.com/EQEmu/Server/pull/3982)) @Akkadius 2024-01-15
|
||||
* Fix datetime zero-value save behavior ([#3976](https://github.com/EQEmu/Server/pull/3976)) @Akkadius 2024-01-14
|
||||
|
||||
### Spawn2
|
||||
|
||||
* Spawn condition value should default spawn_conditions value ([#3980](https://github.com/EQEmu/Server/pull/3980)) @noudess 2024-01-14
|
||||
|
||||
### Zoning
|
||||
|
||||
* Additional logs for zoning under instance checks ([#3989](https://github.com/EQEmu/Server/pull/3989)) @Akkadius 2024-01-22
|
||||
|
||||
## [22.43.1] - 1/14/2024
|
||||
|
||||
### Repositories
|
||||
|
||||
* Revert #3976 - fix character corpses @Akkadius 2024-01-14
|
||||
|
||||
## [22.43.0] - 1/14/2024
|
||||
|
||||
### Database
|
||||
|
||||
* Drop deprecated item_tick table ([#3977](https://github.com/EQEmu/Server/pull/3977)) @Akkadius 2024-01-14
|
||||
|
||||
### Merchants
|
||||
|
||||
* Change database structure for merchant slots ([#3974](https://github.com/EQEmu/Server/pull/3974)) @joligario 2024-01-14
|
||||
|
||||
### Repositories
|
||||
|
||||
* Fix datetime zero-value save behavior ([#3976](https://github.com/EQEmu/Server/pull/3976)) @Akkadius 2024-01-14
|
||||
|
||||
### Zones
|
||||
|
||||
* Convert IDLE_WHEN_EMPTY to a Zone Column ([#3891](https://github.com/EQEmu/Server/pull/3891)) @Kinglykrab 2024-01-13
|
||||
|
||||
## [22.42.1] - 1/13/2024
|
||||
|
||||
### Fixes
|
||||
|
||||
* Fix zone database update manifest ([#3972](https://github.com/EQEmu/Server/pull/3972)) @Kinglykrab 2024-01-13
|
||||
* quest::processmobswhilezoneempty() fix. ([#3971](https://github.com/EQEmu/Server/pull/3971)) @noudess 2024-01-13
|
||||
|
||||
## [22.42.0] - 1/13/2024
|
||||
|
||||
### AAs
|
||||
|
||||
* Convert Loading of AAs to Repositories ([#3963](https://github.com/EQEmu/Server/pull/3963)) @Kinglykrab 2024-01-13
|
||||
|
||||
### Auras
|
||||
|
||||
* Convert Get of Auras to Repositories ([#3964](https://github.com/EQEmu/Server/pull/3964)) @Kinglykrab 2024-01-13
|
||||
|
||||
### Character
|
||||
|
||||
* Character EXP Modifiers in Memory ([#3934](https://github.com/EQEmu/Server/pull/3934)) @Kinglykrab 2024-01-13
|
||||
* Convert Character Corpses to Repositories ([#3941](https://github.com/EQEmu/Server/pull/3941)) @Kinglykrab 2024-01-13
|
||||
* Convert Save of Character Languages to Repositories ([#3948](https://github.com/EQEmu/Server/pull/3948)) @Kinglykrab 2024-01-12
|
||||
|
||||
### Code
|
||||
|
||||
* Cleanup AddCash() and RemoveCash() NPC Methods ([#3957](https://github.com/EQEmu/Server/pull/3957)) @Kinglykrab 2024-01-12
|
||||
* Cleanup ChangeSize() ([#3959](https://github.com/EQEmu/Server/pull/3959)) @Kinglykrab 2024-01-12
|
||||
* Cleanup Owner Related Mob Methods ([#3960](https://github.com/EQEmu/Server/pull/3960)) @Kinglykrab 2024-01-13
|
||||
* Cleanup RandomizeFeatures() ([#3958](https://github.com/EQEmu/Server/pull/3958)) @Kinglykrab 2024-01-12
|
||||
* Remove GroupCount() and RaidGroupCount() ([#3943](https://github.com/EQEmu/Server/pull/3943)) @Kinglykrab 2024-01-13
|
||||
* Remove unused Grid methods ([#3944](https://github.com/EQEmu/Server/pull/3944)) @Kinglykrab 2024-01-13
|
||||
|
||||
### Commands
|
||||
|
||||
* Convert NPC Spawn Methods to Repositories ([#3956](https://github.com/EQEmu/Server/pull/3956)) @Kinglykrab 2024-01-13
|
||||
|
||||
### Crash Fix
|
||||
|
||||
* Character Creation Class/Race out of Range. ([#3920](https://github.com/EQEmu/Server/pull/3920)) @fryguy503 2024-01-09
|
||||
|
||||
### Feat
|
||||
|
||||
* Alt Sinister Strike Formula ([#3921](https://github.com/EQEmu/Server/pull/3921)) @fryguy503 2024-01-09
|
||||
|
||||
### Feature
|
||||
|
||||
* Add Lore Item Trade Error ([#3932](https://github.com/EQEmu/Server/pull/3932)) @fryguy503 2024-01-13
|
||||
* Rule: UseLiveBlockedMessage Bard Spam ([#3933](https://github.com/EQEmu/Server/pull/3933)) @fryguy503 2024-01-09
|
||||
|
||||
### Fixes
|
||||
|
||||
* Attack Corpse Skill Up Fix ([#3924](https://github.com/EQEmu/Server/pull/3924)) @fryguy503 2024-01-09
|
||||
* Fix Issue with SetFlyMode() ([#3961](https://github.com/EQEmu/Server/pull/3961)) @Kinglykrab 2024-01-12
|
||||
* Harm Touch Critical Ratio ([#3915](https://github.com/EQEmu/Server/pull/3915)) @fryguy503 2024-01-09
|
||||
* Increase Precision in CheckDoubleAttack ([#3928](https://github.com/EQEmu/Server/pull/3928)) @fryguy503 2024-01-09
|
||||
* IsOfClientBotMerc() for Discipline Messages ([#3940](https://github.com/EQEmu/Server/pull/3940)) @fryguy503 2024-01-09
|
||||
* Limit MeleeMitigationEffect to defender if only client. ([#3918](https://github.com/EQEmu/Server/pull/3918)) @fryguy503 2024-01-09
|
||||
* Rampage Number of Hits Limit ([#3929](https://github.com/EQEmu/Server/pull/3929)) @fryguy503 2024-01-09
|
||||
* Remove duplicate character_data repository in zonedb.cpp ([#3935](https://github.com/EQEmu/Server/pull/3935)) @Kinglykrab 2024-01-09
|
||||
* Undead Should Never Flee ([#3926](https://github.com/EQEmu/Server/pull/3926)) @fryguy503 2024-01-09
|
||||
|
||||
### Global Loot
|
||||
|
||||
* Convert Global Loot to Repositories ([#3962](https://github.com/EQEmu/Server/pull/3962)) @Kinglykrab 2024-01-13
|
||||
|
||||
### Ground Spawns
|
||||
|
||||
* Convert Ground Spawns to Repositories ([#3967](https://github.com/EQEmu/Server/pull/3967)) @Kinglykrab 2024-01-13
|
||||
|
||||
### Horses
|
||||
|
||||
* Convert Horses to Repositories ([#3965](https://github.com/EQEmu/Server/pull/3965)) @Kinglykrab 2024-01-13
|
||||
|
||||
### Item Ticks
|
||||
|
||||
* Remove Item Ticks Code ([#3955](https://github.com/EQEmu/Server/pull/3955)) @Kinglykrab 2024-01-13
|
||||
|
||||
### Mercenaries
|
||||
|
||||
* Convert Mercenaries to Repositories ([#3947](https://github.com/EQEmu/Server/pull/3947)) @Kinglykrab 2024-01-13
|
||||
|
||||
### Merchants
|
||||
|
||||
* Convert Clear/Delete/Save of Temporary Merchant Lists to Repositories ([#3945](https://github.com/EQEmu/Server/pull/3945)) @Kinglykrab 2024-01-13
|
||||
|
||||
### NPCs
|
||||
|
||||
* Convert Load of NPC Emotes to Repositories ([#3954](https://github.com/EQEmu/Server/pull/3954)) @Kinglykrab 2024-01-13
|
||||
|
||||
### Objects
|
||||
|
||||
* Convert Add/Delete/Update of Objects to Repositories ([#3966](https://github.com/EQEmu/Server/pull/3966)) @Kinglykrab 2024-01-13
|
||||
* Convert World Containers to Repositories ([#3951](https://github.com/EQEmu/Server/pull/3951)) @Kinglykrab 2024-01-13
|
||||
|
||||
### Pets
|
||||
|
||||
* Convert Pets to Repositories ([#3968](https://github.com/EQEmu/Server/pull/3968)) @Kinglykrab 2024-01-13
|
||||
|
||||
### Repositories
|
||||
|
||||
* Add null integer column support, instance_list notes migration, regenerate repositories ([#3969](https://github.com/EQEmu/Server/pull/3969)) @Akkadius 2024-01-13
|
||||
|
||||
### Respawns
|
||||
|
||||
* Convert Respawn Times to Repositories ([#3949](https://github.com/EQEmu/Server/pull/3949)) @Kinglykrab 2024-01-13
|
||||
|
||||
### Rules
|
||||
|
||||
* Add rule for bard aggro cap ([#3909](https://github.com/EQEmu/Server/pull/3909)) @fryguy503 2024-01-09
|
||||
* Allow GMs to silently summon ([#3910](https://github.com/EQEmu/Server/pull/3910)) @fryguy503 2024-01-09
|
||||
* Bash Two Hander use Shoulders ([#3925](https://github.com/EQEmu/Server/pull/3925)) @fryguy503 2024-01-09
|
||||
* Classic Spell Data SPA Calc variability ([#3931](https://github.com/EQEmu/Server/pull/3931)) @fryguy503 2024-01-09
|
||||
* Classic Tracking Skillups ([#3923](https://github.com/EQEmu/Server/pull/3923)) @fryguy503 2024-01-09
|
||||
* Separate Tradeskill Max Train from Research. ([#3916](https://github.com/EQEmu/Server/pull/3916)) @fryguy503 2024-01-09
|
||||
|
||||
### Tasks
|
||||
|
||||
* Add Support for Task Window Element Groups ([#3902](https://github.com/EQEmu/Server/pull/3902)) @hgtw 2024-01-09
|
||||
|
||||
### Traps
|
||||
|
||||
* Convert Load of LDoN Traps/Trap Entries to Repositories ([#3953](https://github.com/EQEmu/Server/pull/3953)) @Kinglykrab 2024-01-13
|
||||
|
||||
### Zones
|
||||
|
||||
* Convert Get/Set of Zone Timezone to Repositories ([#3946](https://github.com/EQEmu/Server/pull/3946)) @Kinglykrab 2024-01-13
|
||||
* Convert IDLE_WHEN_EMPTY to a Zone Column ([#3891](https://github.com/EQEmu/Server/pull/3891)) @Kinglykrab 2024-01-13
|
||||
* Convert SaveZoneCFG to Repositories ([#3950](https://github.com/EQEmu/Server/pull/3950)) @Kinglykrab 2024-01-13
|
||||
|
||||
## [22.41.0] - 1/8/2024
|
||||
|
||||
### Bug
|
||||
|
||||
* DI Buff Fade ([#3919](https://github.com/EQEmu/Server/pull/3919)) @fryguy503 2024-01-08
|
||||
* NPCs will now only proc on hit ([#3913](https://github.com/EQEmu/Server/pull/3913)) @fryguy503 2024-01-08
|
||||
* Pets should not ignore Z axis ([#3912](https://github.com/EQEmu/Server/pull/3912)) @fryguy503 2024-01-08
|
||||
|
||||
### Fixes
|
||||
|
||||
* Disciplines should show when someone casts them. ([#3901](https://github.com/EQEmu/Server/pull/3901)) @fryguy503 2024-01-08
|
||||
* Fix Typo in Character Skills loading ([#3937](https://github.com/EQEmu/Server/pull/3937)) @Kinglykrab 2024-01-09
|
||||
* Fix for HasLockoutByCharacterID ([#3927](https://github.com/EQEmu/Server/pull/3927)) @fryguy503 2024-01-08
|
||||
* Harm Touch, Improved Harm Touch, and Unholy Touch ([#3904](https://github.com/EQEmu/Server/pull/3904)) @fryguy503 2024-01-08
|
||||
* Legacy Manaburn should have hard cap. ([#3905](https://github.com/EQEmu/Server/pull/3905)) @fryguy503 2024-01-08
|
||||
* TGB - Added logic to stop bard errors on group songs. ([#3906](https://github.com/EQEmu/Server/pull/3906)) @fryguy503 2024-01-08
|
||||
* World Shutdown Filter ([#3930](https://github.com/EQEmu/Server/pull/3930)) @fryguy503 2024-01-08
|
||||
|
||||
### Info
|
||||
|
||||
* Adding textual feedback when trying to sell alt items back to … ([#3917](https://github.com/EQEmu/Server/pull/3917)) @fryguy503 2024-01-08
|
||||
|
||||
### Rules
|
||||
|
||||
* Backstab Damage Modifier ([#3908](https://github.com/EQEmu/Server/pull/3908)) @fryguy503 2024-01-08
|
||||
* Classic Tradeskill Skill Clamp ([#3914](https://github.com/EQEmu/Server/pull/3914)) @fryguy503 2024-01-08
|
||||
* Classic Triple Attack ([#3903](https://github.com/EQEmu/Server/pull/3903)) @fryguy503 2024-01-08
|
||||
* Ensure mana taps only effect NPC's that have mana. ([#3907](https://github.com/EQEmu/Server/pull/3907)) @fryguy503 2024-01-08
|
||||
* Over Taunt Hate ([#3900](https://github.com/EQEmu/Server/pull/3900)) @fryguy503 2024-01-08
|
||||
* Stun Chance Percent Rule ([#3922](https://github.com/EQEmu/Server/pull/3922)) @fryguy503 2024-01-08
|
||||
|
||||
## [22.40.0] - 1/7/2024
|
||||
|
||||
### Account
|
||||
|
||||
* Convert Get/Update Account Karma to Repositories ([#3858](https://github.com/EQEmu/Server/pull/3858)) @Kinglykrab 2024-01-07
|
||||
* Convert UpdateGMStatus to Repositories ([#3859](https://github.com/EQEmu/Server/pull/3859)) @Kinglykrab 2024-01-07
|
||||
|
||||
### Bots
|
||||
|
||||
* Resist Spell Fix ([#3840](https://github.com/EQEmu/Server/pull/3840)) @dariusuknuis 2024-01-07
|
||||
|
||||
### Bugfix
|
||||
|
||||
* Negative Aggro Fix ([#3866](https://github.com/EQEmu/Server/pull/3866)) @fryguy503 2024-01-07
|
||||
|
||||
### Character
|
||||
|
||||
* Convert Clear/Delete/Get/Update of Character Item Recast to Repositories ([#3857](https://github.com/EQEmu/Server/pull/3857)) @Kinglykrab 2024-01-07
|
||||
* Convert Delete/Load/Remove/Save of Character AA to Repositories ([#3849](https://github.com/EQEmu/Server/pull/3849)) @Kinglykrab 2024-01-07
|
||||
* Convert Delete/Load/Save of Character Bandolier to Repositories ([#3845](https://github.com/EQEmu/Server/pull/3845)) @Kinglykrab 2024-01-07
|
||||
* Convert Delete/Load/Save of Character Disciplines to Repositories ([#3850](https://github.com/EQEmu/Server/pull/3850)) @Kinglykrab 2024-01-07
|
||||
* Convert Delete/Load/Save of Character Leadership Abilities to Repositories ([#3847](https://github.com/EQEmu/Server/pull/3847)) @Kinglykrab 2024-01-07
|
||||
* Convert Delete/Load/Save of Character Material to Repositories ([#3846](https://github.com/EQEmu/Server/pull/3846)) @Kinglykrab 2024-01-07
|
||||
* Convert Delete/Load/Save of Character Spells to Repositories ([#3842](https://github.com/EQEmu/Server/pull/3842)) @Kinglykrab 2024-01-07
|
||||
* Convert Delete/Save of Character Memmed Spells to Repositories ([#3841](https://github.com/EQEmu/Server/pull/3841)) @Kinglykrab 2024-01-07
|
||||
* Convert Load/Save of Character Bind to Repositories ([#3851](https://github.com/EQEmu/Server/pull/3851)) @Kinglykrab 2024-01-07
|
||||
* Convert Load/Save of Character Buffs to Repositories ([#3855](https://github.com/EQEmu/Server/pull/3855)) @Kinglykrab 2024-01-07
|
||||
* Convert Load/Save of Character Currency to Repositories ([#3848](https://github.com/EQEmu/Server/pull/3848)) @Kinglykrab 2024-01-07
|
||||
* Convert Load/Save of Character Data to Repositories ([#3839](https://github.com/EQEmu/Server/pull/3839)) @Kinglykrab 2024-01-07
|
||||
* Convert Load/Save of Character Potion Belt to Repositories ([#3844](https://github.com/EQEmu/Server/pull/3844)) @Kinglykrab 2024-01-07
|
||||
* Convert Load/Save of Character Skills to Repositories ([#3843](https://github.com/EQEmu/Server/pull/3843)) @Kinglykrab 2024-01-07
|
||||
* Convert Load/Update of Character Alternate Currencies to Repositories ([#3856](https://github.com/EQEmu/Server/pull/3856)) @Kinglykrab 2024-01-07
|
||||
* Convert NoRentExpired to Repositories ([#3860](https://github.com/EQEmu/Server/pull/3860)) @Kinglykrab 2024-01-07
|
||||
|
||||
### Characters
|
||||
|
||||
* Convert Load/Save of Character Auras to Repositories ([#3854](https://github.com/EQEmu/Server/pull/3854)) @Kinglykrab 2024-01-07
|
||||
|
||||
### Code
|
||||
|
||||
* Remove bot-based saylink method ([#3852](https://github.com/EQEmu/Server/pull/3852)) @Kinglykrab 2024-01-07
|
||||
|
||||
### Commands
|
||||
|
||||
* Add #clearxtargets Command ([#3833](https://github.com/EQEmu/Server/pull/3833)) @Kinglykrab 2024-01-07
|
||||
* Add scoped buckets and editing to #databuckets ([#3826](https://github.com/EQEmu/Server/pull/3826)) @Kinglykrab 2024-01-07
|
||||
* Cleanup #appearance Command ([#3827](https://github.com/EQEmu/Server/pull/3827)) @Kinglykrab 2024-01-07
|
||||
* Cleanup #fixmob Command ([#3828](https://github.com/EQEmu/Server/pull/3828)) @Kinglykrab 2024-01-07
|
||||
* Cleanup #petname Command ([#3829](https://github.com/EQEmu/Server/pull/3829)) @Kinglykrab 2024-01-07
|
||||
* Cleanup #shutdown Command ([#3830](https://github.com/EQEmu/Server/pull/3830)) @Kinglykrab 2024-01-07
|
||||
* Remove #zopp Command ([#3831](https://github.com/EQEmu/Server/pull/3831)) @Kinglykrab 2024-01-07
|
||||
|
||||
### Crash
|
||||
|
||||
* Fix crash where Raid invite could be accepted after forming group with the Raid invitor. ([#3837](https://github.com/EQEmu/Server/pull/3837)) @Aeadoin 2024-01-06
|
||||
|
||||
### Feature
|
||||
|
||||
* Break Trader if moved ([#3862](https://github.com/EQEmu/Server/pull/3862)) @fryguy503 2024-01-07
|
||||
* Formula Addition (40+ Harm Touch) ([#3870](https://github.com/EQEmu/Server/pull/3870)) @fryguy503 2024-01-07
|
||||
* Legacy Fizzle Code ([#3868](https://github.com/EQEmu/Server/pull/3868)) @fryguy503 2024-01-07
|
||||
* Legacy Manaburn Rule ([#3872](https://github.com/EQEmu/Server/pull/3872)) @fryguy503 2024-01-07
|
||||
|
||||
### Fixes
|
||||
|
||||
* Add locations where melee can be bound outside of a city. ([#3887](https://github.com/EQEmu/Server/pull/3887)) @fryguy503 2024-01-07
|
||||
* Amplification should not benefit from instrument mods ([#3898](https://github.com/EQEmu/Server/pull/3898)) @fryguy503 2024-01-07
|
||||
* Bard Caster Level Fixes ([#3883](https://github.com/EQEmu/Server/pull/3883)) @fryguy503 2024-01-07
|
||||
* Buff Sync ([#3896](https://github.com/EQEmu/Server/pull/3896)) @fryguy503 2024-01-07
|
||||
* Cancel Magic SE fix ([#3890](https://github.com/EQEmu/Server/pull/3890)) @fryguy503 2024-01-07
|
||||
* Class Trainers dont steal your money! ([#3864](https://github.com/EQEmu/Server/pull/3864)) @fryguy503 2024-01-07
|
||||
* Clear Ramp when Clearing hate ([#3892](https://github.com/EQEmu/Server/pull/3892)) @fryguy503 2024-01-07
|
||||
* DI/Death Pact Fix ([#3867](https://github.com/EQEmu/Server/pull/3867)) @fryguy503 2024-01-07
|
||||
* Depop Charm Pet and Detach Debuffs on Evacuate ([#3888](https://github.com/EQEmu/Server/pull/3888)) @fryguy503 2024-01-07
|
||||
* Dire Charm Reset ([#3875](https://github.com/EQEmu/Server/pull/3875)) @fryguy503 2024-01-07
|
||||
* Disciplines Getting Focuses Fix ([#3884](https://github.com/EQEmu/Server/pull/3884)) @fryguy503 2024-01-07
|
||||
* Fix issue with 9th/10th inventory slot ([#3835](https://github.com/EQEmu/Server/pull/3835)) @Kinglykrab 2024-01-03
|
||||
* Fix typo on ZoneDatabase::LoadPetInfo ([#3871](https://github.com/EQEmu/Server/pull/3871)) @Kinglykrab 2024-01-07
|
||||
* Harm Touch Unholy Disc Type ([#3874](https://github.com/EQEmu/Server/pull/3874)) @fryguy503 2024-01-07
|
||||
* Prevent QS Crashes ([#3877](https://github.com/EQEmu/Server/pull/3877)) @fryguy503 2024-01-07
|
||||
* Rez Effects Stacking ([#3882](https://github.com/EQEmu/Server/pull/3882)) @fryguy503 2024-01-07
|
||||
* Rez in zone clear aggro ([#3895](https://github.com/EQEmu/Server/pull/3895)) @fryguy503 2024-01-07
|
||||
* Rune Invis Break ([#3893](https://github.com/EQEmu/Server/pull/3893)) @fryguy503 2024-01-07
|
||||
* Snare and DOT Stacking ([#3897](https://github.com/EQEmu/Server/pull/3897)) @fryguy503 2024-01-07
|
||||
* Swim Skillup and Underwater Fall Damage Fix ([#3885](https://github.com/EQEmu/Server/pull/3885)) @fryguy503 2024-01-07
|
||||
* Swimming Rules Adjustment and Racial ([#3889](https://github.com/EQEmu/Server/pull/3889)) @fryguy503 2024-01-07
|
||||
* Target Locked Pet Taunt ([#3894](https://github.com/EQEmu/Server/pull/3894)) @fryguy503 2024-01-07
|
||||
* Vampiric Embrace Fixes ([#3873](https://github.com/EQEmu/Server/pull/3873)) @fryguy503 2024-01-07
|
||||
|
||||
### Languages
|
||||
|
||||
* Cleanup language constants, use repositories ([#3838](https://github.com/EQEmu/Server/pull/3838)) @Kinglykrab 2024-01-07
|
||||
|
||||
### Pets
|
||||
|
||||
* Convert Load/Save of Pet Info to Repositories ([#3853](https://github.com/EQEmu/Server/pull/3853)) @Kinglykrab 2024-01-07
|
||||
|
||||
### Rules
|
||||
|
||||
* Casting Charm on over level = Aggro ([#3886](https://github.com/EQEmu/Server/pull/3886)) @fryguy503 2024-01-07
|
||||
* Classic Invite Requires Target ([#3878](https://github.com/EQEmu/Server/pull/3878)) @fryguy503 2024-01-07
|
||||
* Evac Aggro Wipe ([#3880](https://github.com/EQEmu/Server/pull/3880)) @fryguy503 2024-01-07
|
||||
* Mounts will wear off on zone ([#3865](https://github.com/EQEmu/Server/pull/3865)) @fryguy503 2024-01-07
|
||||
* PC Push and NPCtoNPC Push ([#3879](https://github.com/EQEmu/Server/pull/3879)) @fryguy503 2024-01-07
|
||||
* RequireMnemonicRetention for Spells 9-12 Rule ([#3876](https://github.com/EQEmu/Server/pull/3876)) @fryguy503 2024-01-07
|
||||
* Resist Softcap rules ([#3863](https://github.com/EQEmu/Server/pull/3863)) @fryguy503 2024-01-07
|
||||
* Restrict Finishing Blow to only Fleeing NPC's. ([#3869](https://github.com/EQEmu/Server/pull/3869)) @fryguy503 2024-01-07
|
||||
* Undead Aggro ([#3881](https://github.com/EQEmu/Server/pull/3881)) @fryguy503 2024-01-07
|
||||
|
||||
### Tuning
|
||||
|
||||
* FD and Sneak break when cast on adjustments. ([#3861](https://github.com/EQEmu/Server/pull/3861)) @fryguy503 2024-01-07
|
||||
|
||||
### UCS
|
||||
|
||||
* Consolidate configuration block ([#3768](https://github.com/EQEmu/Server/pull/3768)) @Akkadius 2024-01-07
|
||||
|
||||
## [22.39.1] - 12/31/2023
|
||||
|
||||
### Code
|
||||
|
||||
* Appearance not appearence ([#3819](https://github.com/EQEmu/Server/pull/3819)) @Kinglykrab 2023-12-30
|
||||
* Delete errmsg.h in common and zone ([#3821](https://github.com/EQEmu/Server/pull/3821)) @Kinglykrab 2023-12-30
|
||||
* Gender constants cleanup ([#3817](https://github.com/EQEmu/Server/pull/3817)) @Kinglykrab 2023-12-30
|
||||
* Remove MakeSpawnUpdateNoDelta from mob.cpp/mob.h ([#3816](https://github.com/EQEmu/Server/pull/3816)) @Kinglykrab 2023-12-31
|
||||
* Remove SendStunAppearance from mob.cpp/mob.h ([#3818](https://github.com/EQEmu/Server/pull/3818)) @Kinglykrab 2023-12-31
|
||||
* Remove unused PlotPosition methods from mob.cpp/mob.h ([#3820](https://github.com/EQEmu/Server/pull/3820)) @Kinglykrab 2023-12-31
|
||||
|
||||
### Database
|
||||
|
||||
* Database update improvements, content db and terminal checks ([#3814](https://github.com/EQEmu/Server/pull/3814)) @Akkadius 2023-12-31
|
||||
|
||||
### Fixes
|
||||
|
||||
* Client:SetBucket Overload Incorrectly Named ([#3825](https://github.com/EQEmu/Server/pull/3825)) @fryguy503 2023-12-30
|
||||
* Fix crash in Client::Handle_OP_GMGoto ([#3832](https://github.com/EQEmu/Server/pull/3832)) @Kinglykrab 2023-12-31
|
||||
|
||||
### Quest API
|
||||
|
||||
* Add HasItemOnCorpse() to Perl/Lua ([#3824](https://github.com/EQEmu/Server/pull/3824)) @Kinglykrab 2023-12-31
|
||||
* Fix issue with death events. ([#3823](https://github.com/EQEmu/Server/pull/3823)) @Kinglykrab 2023-12-31
|
||||
|
||||
### Repositories
|
||||
|
||||
* Protected extended repositories from being overwritten if exists ([#3815](https://github.com/EQEmu/Server/pull/3815)) @Akkadius 2023-12-31
|
||||
|
||||
## [22.39.0] - 12/27/2023
|
||||
|
||||
### Character
|
||||
|
||||
* Fix character copier due to schema change ([#3805](https://github.com/EQEmu/Server/pull/3805)) @Akkadius 2023-12-28
|
||||
|
||||
### Combat
|
||||
|
||||
* Disarm was not dropping item to ground due to bug ([#3811](https://github.com/EQEmu/Server/pull/3811)) @noudess 2023-12-27
|
||||
|
||||
### Logs
|
||||
|
||||
* Bulk insert new log settings ([#3810](https://github.com/EQEmu/Server/pull/3810)) @Akkadius 2023-12-28
|
||||
* Reclassify unhelpful Info message ([#3809](https://github.com/EQEmu/Server/pull/3809)) @Akkadius 2023-12-28
|
||||
|
||||
### MySQL
|
||||
|
||||
* Fix MySQL Query error formatting ([#3808](https://github.com/EQEmu/Server/pull/3808)) @Akkadius 2023-12-28
|
||||
|
||||
### Objects
|
||||
|
||||
* Remove "No objects to load for zone" error message ([#3807](https://github.com/EQEmu/Server/pull/3807)) @Akkadius 2023-12-28
|
||||
|
||||
### Player Events
|
||||
|
||||
* Bulk replace settings on boot ([#3806](https://github.com/EQEmu/Server/pull/3806)) @Akkadius 2023-12-28
|
||||
|
||||
### Tasks
|
||||
|
||||
* Add enabled column ([#3804](https://github.com/EQEmu/Server/pull/3804)) @Akkadius 2023-12-28
|
||||
|
||||
## [22.38.0] - 12/26/2023
|
||||
|
||||
### Bots
|
||||
|
||||
* Remove unnecessary error on SetItemReuse ([#3795](https://github.com/EQEmu/Server/pull/3795)) @nytmyr 2023-12-20
|
||||
|
||||
### Code
|
||||
|
||||
* Consolidate GetHateRandom(), GetHateRandomBot(), GetHateRandomClient(), and GetHateRandomNPC() ([#3794](https://github.com/EQEmu/Server/pull/3794)) @Kinglykrab 2023-12-25
|
||||
* Race constants refactor ([#3782](https://github.com/EQEmu/Server/pull/3782)) @Akkadius 2023-12-23
|
||||
|
||||
### Database
|
||||
|
||||
* Fix issue with saylinks query in MySQL 8.0+ ([#3800](https://github.com/EQEmu/Server/pull/3800)) @Akkadius 2023-12-24
|
||||
* Update faction mods with Live data ([#3799](https://github.com/EQEmu/Server/pull/3799)) @joligario 2023-12-23
|
||||
|
||||
### Fixes
|
||||
|
||||
* Disable Hide/Improved Hide on Trap damage ([#3791](https://github.com/EQEmu/Server/pull/3791)) @Kinglykrab 2023-12-19
|
||||
* Fix Bard Invisibility Songs breaking every 4 ticks ([#3783](https://github.com/EQEmu/Server/pull/3783)) @Kinglykrab 2023-12-19
|
||||
* Fix can_riposte parameter in DoMeleeSkillAttackDmg ([#3792](https://github.com/EQEmu/Server/pull/3792)) @Kinglykrab 2023-12-19
|
||||
|
||||
### Forage
|
||||
|
||||
* Add a rule to disabled using common_food_ids from the list in forage.cpp. currently set to enabled. ([#3796](https://github.com/EQEmu/Server/pull/3796)) @regneq 2023-12-22
|
||||
|
||||
### NPC
|
||||
|
||||
* Support for multiple emotes per type, emote variables ([#3801](https://github.com/EQEmu/Server/pull/3801)) @regneq 2023-12-25
|
||||
|
||||
### Quest API
|
||||
|
||||
* Add GetHateTopBot(), GetHateTopClient(), and GetHateTopNPC() to Perl/Lua ([#3793](https://github.com/EQEmu/Server/pull/3793)) @Kinglykrab 2023-12-22
|
||||
* Add SummonItemIntoInventory() to Perl/Lua ([#3797](https://github.com/EQEmu/Server/pull/3797)) @Kinglykrab 2023-12-22
|
||||
|
||||
### Repositories
|
||||
|
||||
* Add ReplaceOne and ReplaceMany ([#3802](https://github.com/EQEmu/Server/pull/3802)) @Akkadius 2023-12-26
|
||||
|
||||
## [22.37.0] - 12/18/2023
|
||||
|
||||
### Bots
|
||||
|
||||
* Add ScanCloseMobs support to fix AEs ([#3786](https://github.com/EQEmu/Server/pull/3786)) @nytmyr 2023-12-18
|
||||
* Expand ^itemuse options ([#3756](https://github.com/EQEmu/Server/pull/3756)) @nytmyr 2023-12-17
|
||||
* Fix ^defensive from checking aggressive disciplines. ([#3787](https://github.com/EQEmu/Server/pull/3787)) @nytmyr 2023-12-18
|
||||
* Fix ^oo autodefend from sending bots/pets to invalid haters ([#3772](https://github.com/EQEmu/Server/pull/3772)) @nytmyr 2023-12-16
|
||||
* Fix unnecessary failed to save timer error ([#3788](https://github.com/EQEmu/Server/pull/3788)) @nytmyr 2023-12-18
|
||||
* [Quest API] Add ^clickitem, ^timer, fix GetBestBotSpellForCure ([#3755](https://github.com/EQEmu/Server/pull/3755)) @nytmyr 2023-12-17
|
||||
|
||||
### CI
|
||||
|
||||
* Switch to use clang for Linux builds (speed) ([#3777](https://github.com/EQEmu/Server/pull/3777)) @Akkadius 2023-12-17
|
||||
|
||||
### Compilation
|
||||
|
||||
* Use pre-compiled headers for Windows (speed) ([#3778](https://github.com/EQEmu/Server/pull/3778)) @Akkadius 2023-12-18
|
||||
|
||||
### Fixes
|
||||
|
||||
* Drop Invisibility when hit by traps ([#3785](https://github.com/EQEmu/Server/pull/3785)) @Kinglykrab 2023-12-18
|
||||
* Fix NPCs routing to 0.0, 0.0 on #summon ([#3780](https://github.com/EQEmu/Server/pull/3780)) @Kinglykrab 2023-12-18
|
||||
* Fix bad merge @Akkadius 2023-12-17
|
||||
* Fix issue with HOTBonusHealingSplitOverDuration Rule ([#3776](https://github.com/EQEmu/Server/pull/3776)) @Kinglykrab 2023-12-17
|
||||
* Fixed the discrepacy with time using command #time and in quests. ([#3767](https://github.com/EQEmu/Server/pull/3767)) @regneq 2023-12-17
|
||||
* Send Entity ID in Death Events to resolve #3721 ([#3779](https://github.com/EQEmu/Server/pull/3779)) @Kinglykrab 2023-12-18
|
||||
|
||||
### Quest API
|
||||
|
||||
* Add EVENT_ALT_CURRENCY_GAIN and EVENT_ALT_CURRENCY_LOSS to Perl/Lua ([#3734](https://github.com/EQEmu/Server/pull/3734)) @Kinglykrab 2023-12-17
|
||||
* Add EVENT_CRYSTAL_GAIN and EVENT_CRYSTAL_LOSS to Perl/Lua ([#3735](https://github.com/EQEmu/Server/pull/3735)) @Kinglykrab 2023-12-17
|
||||
* Add EVENT_LDON_POINTS_GAIN and EVENT_LDON_POINTS_LOSS to Perl/Lua ([#3742](https://github.com/EQEmu/Server/pull/3742)) @Kinglykrab 2023-12-17
|
||||
* Add EVENT_LEVEL_UP and EVENT_LEVEL_DOWN to Bots ([#3750](https://github.com/EQEmu/Server/pull/3750)) @Kinglykrab 2023-12-17
|
||||
* Add EVENT_LOOT_ADDED to Perl/Lua ([#3739](https://github.com/EQEmu/Server/pull/3739)) @Kinglykrab 2023-12-17
|
||||
* Add GetNPCAggro() and SetNPCAggro() to Perl/Lua ([#3781](https://github.com/EQEmu/Server/pull/3781)) @Kinglykrab 2023-12-18
|
||||
|
||||
## [22.36.0] - 12/16/2023
|
||||
|
||||
### Bots
|
||||
|
||||
@@ -17,6 +17,7 @@ SET(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
SET(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
OPTION(EQEMU_BUILD_STATIC "Build with static linking" OFF)
|
||||
OPTION(EQEMU_BUILD_PCH "Build with precompiled headers (Windows)" ON)
|
||||
|
||||
IF (EQEMU_BUILD_STATIC)
|
||||
SET(BUILD_SHARED_LIBS OFF)
|
||||
|
||||
@@ -13,7 +13,6 @@ SET(common_sources
|
||||
crc32.cpp
|
||||
database/database_dump_service.cpp
|
||||
database.cpp
|
||||
database_conversions.cpp
|
||||
database_instances.cpp
|
||||
database/database_update_manifest.cpp
|
||||
database/database_update_manifest_bots.cpp
|
||||
@@ -231,7 +230,6 @@ SET(repositories
|
||||
repositories/base/base_inventory_snapshots_repository.h
|
||||
repositories/base/base_ip_exemptions_repository.h
|
||||
repositories/base/base_items_repository.h
|
||||
repositories/base/base_item_tick_repository.h
|
||||
repositories/base/base_ldon_trap_entries_repository.h
|
||||
repositories/base/base_ldon_trap_templates_repository.h
|
||||
repositories/base/base_level_exp_mods_repository.h
|
||||
@@ -409,7 +407,6 @@ SET(repositories
|
||||
repositories/inventory_snapshots_repository.h
|
||||
repositories/ip_exemptions_repository.h
|
||||
repositories/items_repository.h
|
||||
repositories/item_tick_repository.h
|
||||
repositories/ldon_trap_entries_repository.h
|
||||
repositories/ldon_trap_templates_repository.h
|
||||
repositories/level_exp_mods_repository.h
|
||||
@@ -541,7 +538,6 @@ SET(common_headers
|
||||
events/player_event_logs.h
|
||||
events/player_event_discord_formatter.h
|
||||
events/player_events.h
|
||||
errmsg.h
|
||||
event_sub.h
|
||||
expedition_lockout_timer.h
|
||||
extprofile.h
|
||||
@@ -563,7 +559,6 @@ SET(common_headers
|
||||
item_fieldlist.h
|
||||
item_instance.h
|
||||
json_config.h
|
||||
languages.h
|
||||
light_source.h
|
||||
linked_list.h
|
||||
loottable.h
|
||||
@@ -792,5 +787,8 @@ IF (UNIX)
|
||||
SET_SOURCE_FILES_PROPERTIES("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/rof2.cpp" "patches/uf.cpp" PROPERTIES COMPILE_FLAGS -O0)
|
||||
ENDIF (UNIX)
|
||||
|
||||
IF (WIN32 AND EQEMU_BUILD_PCH)
|
||||
TARGET_PRECOMPILE_HEADERS(common PRIVATE pch/pch.h)
|
||||
ENDIF()
|
||||
|
||||
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||
|
||||
+13
-3
@@ -54,6 +54,7 @@
|
||||
|
||||
#include "repositories/zone_repository.h"
|
||||
#include "zone_store.h"
|
||||
#include "repositories/merchantlist_temp_repository.h"
|
||||
|
||||
extern Client client;
|
||||
|
||||
@@ -1221,8 +1222,9 @@ void Database::GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus) {
|
||||
*oStatus = Strings::ToInt(row[1]);
|
||||
}
|
||||
|
||||
void Database::ClearMerchantTemp(){
|
||||
QueryDatabase("DELETE FROM merchantlist_temp");
|
||||
void Database::ClearMerchantTemp()
|
||||
{
|
||||
MerchantlistTempRepository::ClearTemporaryMerchantLists(*this);
|
||||
}
|
||||
|
||||
bool Database::UpdateName(const char* oldname, const char* newname) {
|
||||
@@ -2246,6 +2248,11 @@ bool Database::CopyCharacter(
|
||||
row = results.begin();
|
||||
std::string new_character_id = row[0];
|
||||
|
||||
std::vector<std::string> tables_to_zero_id = {
|
||||
"keyring",
|
||||
"data_buckets",
|
||||
};
|
||||
|
||||
TransactionBegin();
|
||||
for (const auto &iter : DatabaseSchema::GetCharacterTables()) {
|
||||
std::string table_name = iter.first;
|
||||
@@ -2279,6 +2286,10 @@ bool Database::CopyCharacter(
|
||||
std::string column = columns[column_index];
|
||||
std::string value = row[column_index] ? row[column_index] : "null";
|
||||
|
||||
if (column == "id" && Strings::Contains(tables_to_zero_id, table_name)) {
|
||||
value = "0";
|
||||
}
|
||||
|
||||
if (column == character_id_column_name) {
|
||||
value = new_character_id;
|
||||
}
|
||||
@@ -2326,7 +2337,6 @@ bool Database::CopyCharacter(
|
||||
if (!insert.ErrorMessage().empty()) {
|
||||
TransactionRollback();
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,11 +226,6 @@ public:
|
||||
|
||||
void PurgeAllDeletedDataBuckets();
|
||||
|
||||
/* Database Conversions 'database_conversions.cpp' */
|
||||
|
||||
bool CheckDatabaseConversions();
|
||||
bool CheckDatabaseConvertCorpseDeblob();
|
||||
bool CheckDatabaseConvertPPDeblob();
|
||||
|
||||
/* Database Variables */
|
||||
|
||||
|
||||
@@ -76,9 +76,9 @@ void DatabaseUpdate::CheckDbUpdates()
|
||||
}
|
||||
}
|
||||
|
||||
std::string DatabaseUpdate::GetQueryResult(std::string query)
|
||||
std::string DatabaseUpdate::GetQueryResult(const ManifestEntry& e)
|
||||
{
|
||||
auto results = m_database->QueryDatabase(query);
|
||||
auto results = (e.content_schema_update ? m_content_database : m_database)->QueryDatabase(e.check);
|
||||
|
||||
std::vector<std::string> result_lines = {};
|
||||
|
||||
@@ -121,6 +121,16 @@ bool DatabaseUpdate::ShouldRunMigration(ManifestEntry &e, std::string query_resu
|
||||
return false;
|
||||
}
|
||||
|
||||
// check if we are running in a terminal
|
||||
bool is_atty()
|
||||
{
|
||||
#ifdef _WINDOWS
|
||||
return ::_isatty(_fileno(stdin));
|
||||
#else
|
||||
return isatty(fileno(stdin));
|
||||
#endif
|
||||
}
|
||||
|
||||
// return true if we ran updates
|
||||
bool DatabaseUpdate::UpdateManifest(
|
||||
std::vector<ManifestEntry> entries,
|
||||
@@ -136,7 +146,7 @@ bool DatabaseUpdate::UpdateManifest(
|
||||
for (auto &e: entries) {
|
||||
if (e.version == version) {
|
||||
bool has_migration = true;
|
||||
std::string r = GetQueryResult(e.check);
|
||||
std::string r = GetQueryResult(e);
|
||||
if (ShouldRunMigration(e, r)) {
|
||||
has_migration = false;
|
||||
missing_migrations.emplace_back(e.version);
|
||||
@@ -179,7 +189,7 @@ bool DatabaseUpdate::UpdateManifest(
|
||||
if (e.version == m) {
|
||||
bool errored_migration = false;
|
||||
|
||||
auto r = m_database->QueryDatabaseMulti(e.sql);
|
||||
auto r = (e.content_schema_update ? m_content_database : m_database)->QueryDatabaseMulti(e.sql);
|
||||
|
||||
// ignore empty query result "errors"
|
||||
if (r.ErrorNumber() != 1065 && !r.ErrorMessage().empty()) {
|
||||
@@ -187,31 +197,38 @@ bool DatabaseUpdate::UpdateManifest(
|
||||
errored_migration = true;
|
||||
|
||||
LogInfo("Required database update failed. This could be a problem");
|
||||
LogInfo("Would you like to skip this update? [y/n] (Timeout 60s)");
|
||||
|
||||
// user input
|
||||
std::string input;
|
||||
bool gave_input = false;
|
||||
time_t start_time = time(nullptr);
|
||||
time_t wait_time_seconds = 60;
|
||||
// if terminal attached then prompt for skip
|
||||
if (is_atty()) {
|
||||
LogInfo("Would you like to skip this update? [y/n] (Timeout 60s)");
|
||||
|
||||
// spawn a concurrent thread that waits for input from std::cin
|
||||
std::thread t1(
|
||||
[&]() {
|
||||
std::cin >> input;
|
||||
gave_input = true;
|
||||
// user input
|
||||
std::string input;
|
||||
bool gave_input = false;
|
||||
time_t start_time = time(nullptr);
|
||||
time_t wait_time_seconds = 60;
|
||||
|
||||
// spawn a concurrent thread that waits for input from std::cin
|
||||
std::thread t1(
|
||||
[&]() {
|
||||
std::cin >> input;
|
||||
gave_input = true;
|
||||
}
|
||||
);
|
||||
t1.detach();
|
||||
|
||||
// check the inputReceived flag once every 50ms for 10 seconds
|
||||
while (time(nullptr) < start_time + wait_time_seconds && !gave_input) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
}
|
||||
);
|
||||
t1.detach();
|
||||
|
||||
// check the inputReceived flag once every 50ms for 10 seconds
|
||||
while (time(nullptr) < start_time + wait_time_seconds && !gave_input) {
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||
}
|
||||
|
||||
// prompt for user skip
|
||||
if (Strings::Trim(input) == "y") {
|
||||
errored_migration = false;
|
||||
// prompt for user skip
|
||||
if (Strings::Trim(input) == "y") {
|
||||
errored_migration = false;
|
||||
LogInfo("Skipping update [{}] [{}]", e.version, e.description);
|
||||
}
|
||||
} else {
|
||||
errored_migration = true;
|
||||
LogInfo("Skipping update [{}] [{}]", e.version, e.description);
|
||||
}
|
||||
}
|
||||
@@ -247,6 +264,13 @@ DatabaseUpdate *DatabaseUpdate::SetDatabase(Database *db)
|
||||
return this;
|
||||
}
|
||||
|
||||
DatabaseUpdate *DatabaseUpdate::SetContentDatabase(Database *db)
|
||||
{
|
||||
m_content_database = db;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
bool DatabaseUpdate::CheckVersionsUpToDate(DatabaseVersion v, DatabaseVersion b)
|
||||
{
|
||||
LogInfo("{}", Strings::Repeat("-", BREAK_LENGTH));
|
||||
|
||||
@@ -10,6 +10,7 @@ struct ManifestEntry {
|
||||
std::string condition{}; // condition or "match_type" - Possible values [contains|match|missing|empty|not_empty]
|
||||
std::string match{}; // match field that is not always used, but works in conjunction with "condition" values [missing|match|contains]
|
||||
std::string sql{}; // the SQL DDL that gets ran when the condition is true
|
||||
bool content_schema_update{}; // if true, this migration is a content schema update and should be ran against the content database
|
||||
};
|
||||
|
||||
struct DatabaseVersion {
|
||||
@@ -22,14 +23,16 @@ public:
|
||||
DatabaseVersion GetDatabaseVersions();
|
||||
DatabaseVersion GetBinaryDatabaseVersions();
|
||||
void CheckDbUpdates();
|
||||
std::string GetQueryResult(std::string query);
|
||||
std::string GetQueryResult(const ManifestEntry& e);
|
||||
static bool ShouldRunMigration(ManifestEntry &e, std::string query_result);
|
||||
bool UpdateManifest(std::vector<ManifestEntry> entries, int version_low, int version_high);
|
||||
|
||||
DatabaseUpdate *SetDatabase(Database *db);
|
||||
DatabaseUpdate *SetContentDatabase(Database *db);
|
||||
bool HasPendingUpdates();
|
||||
private:
|
||||
Database *m_database;
|
||||
Database *m_content_database;
|
||||
static bool CheckVersionsUpToDate(DatabaseVersion v, DatabaseVersion b);
|
||||
void InjectBotsVersionColumn();
|
||||
};
|
||||
|
||||
@@ -5016,7 +5016,7 @@ CREATE TABLE `spawn2_disabled` (
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4;
|
||||
INSERT INTO spawn2_disabled (spawn2_id, disabled) SELECT id, 1 FROM spawn2 WHERE enabled = 0;
|
||||
ALTER TABLE `spawn2` DROP COLUMN `enabled`;
|
||||
)"
|
||||
)",
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9242,
|
||||
@@ -5028,7 +5028,8 @@ ALTER TABLE `spawn2` DROP COLUMN `enabled`;
|
||||
ALTER TABLE `spawnentry`
|
||||
ADD COLUMN `min_time` smallint(4) NOT NULL DEFAULT 0 AFTER `condition_value_filter`,
|
||||
ADD COLUMN `max_time` smallint(4) NOT NULL DEFAULT 0 AFTER `min_time`;
|
||||
)"
|
||||
)",
|
||||
.content_schema_update = true
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9243,
|
||||
@@ -5082,7 +5083,8 @@ INSERT INTO
|
||||
|
||||
DROP TABLE `starting_items`;
|
||||
RENAME TABLE `starting_items_new` TO `starting_items`;
|
||||
)"
|
||||
)",
|
||||
.content_schema_update = true
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9244,
|
||||
@@ -5092,7 +5094,8 @@ RENAME TABLE `starting_items_new` TO `starting_items`;
|
||||
.match = "0000-00-00 00:00:00",
|
||||
.sql = R"(
|
||||
ALTER TABLE `items` MODIFY COLUMN `updated` datetime NULL DEFAULT NULL;
|
||||
)"
|
||||
)",
|
||||
.content_schema_update = true
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9245,
|
||||
@@ -5104,7 +5107,8 @@ ALTER TABLE `items` MODIFY COLUMN `updated` datetime NULL DEFAULT NULL;
|
||||
ALTER TABLE `object` CHANGE COLUMN `unknown08` `size_percentage` float NOT NULL DEFAULT 0 AFTER `icon`;
|
||||
ALTER TABLE `object` CHANGE COLUMN `unknown10` `solid_type` mediumint(5) NOT NULL DEFAULT 0 AFTER `size`;
|
||||
ALTER TABLE `object` CHANGE COLUMN `unknown20` `incline` int(11) NOT NULL DEFAULT 0 AFTER `solid_type`;
|
||||
)"
|
||||
)",
|
||||
.content_schema_update = true
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9246,
|
||||
@@ -5133,9 +5137,112 @@ CHANGE COLUMN `slot` `inventory_slot` mediumint(9) NOT NULL DEFAULT -1 AFTER `st
|
||||
|
||||
ALTER TABLE `starting_items`
|
||||
CHANGE COLUMN `temporary` `class_list` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL AFTER `id`;
|
||||
)",
|
||||
.content_schema_update = true
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9248,
|
||||
.description = "2023_12_22_drop_npc_emotes_index.sql",
|
||||
.check = "show index from npc_emotes where key_name = 'emoteid'",
|
||||
.condition = "not_empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
ALTER TABLE `npc_emotes` DROP INDEX `emoteid`;
|
||||
)",
|
||||
.content_schema_update = true
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9249,
|
||||
.description = "2023_12_26_add_tasks_enabled_column.sql",
|
||||
.check = "SHOW COLUMNS FROM `tasks` LIKE 'enabled'",
|
||||
.condition = "empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
ALTER TABLE `tasks`
|
||||
ADD COLUMN `enabled` smallint NULL DEFAULT 1 AFTER `faction_amount`
|
||||
)",
|
||||
.content_schema_update = true
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9250,
|
||||
.description = "2023_01_06_task_activities_list_group.sql",
|
||||
.check = "SHOW COLUMNS FROM `task_activities` LIKE 'list_group'",
|
||||
.condition = "empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
ALTER TABLE `task_activities`
|
||||
ADD COLUMN `list_group` TINYINT UNSIGNED NOT NULL DEFAULT '0' AFTER `optional`;
|
||||
)",
|
||||
.content_schema_update = true
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9251,
|
||||
.description = "2023_01_12_instance_list_notes.sql",
|
||||
.check = "SHOW COLUMNS FROM `instance_list` LIKE 'notes'",
|
||||
.condition = "empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
ALTER TABLE `instance_list`
|
||||
ADD COLUMN `notes` varchar(50) NOT NULL DEFAULT '' AFTER `never_expires`;
|
||||
)",
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9252,
|
||||
.description = "2024_01_07_zone_idle_when_empty.sql",
|
||||
.check = "SHOW COLUMNS FROM `zone` LIKE 'idle_when_empty'",
|
||||
.condition = "empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
ALTER TABLE `zone`
|
||||
ADD COLUMN `idle_when_empty` tinyint(1) UNSIGNED NOT NULL DEFAULT 1 AFTER `min_lava_damage`,
|
||||
ADD COLUMN `seconds_before_idle` int(11) UNSIGNED NOT NULL DEFAULT 60 AFTER `idle_when_empty`;
|
||||
)",
|
||||
.content_schema_update = true
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9253,
|
||||
.description = "2024_01_13_merchantlist_slot.sql",
|
||||
.check = "SHOW COLUMNS FROM `merchantlist` LIKE 'slot'",
|
||||
.condition = "missing",
|
||||
.match = "unsigned",
|
||||
.sql = R"(
|
||||
ALTER TABLE `merchantlist`
|
||||
MODIFY COLUMN `slot` int(11) UNSIGNED NOT NULL DEFAULT 0
|
||||
)",
|
||||
.content_schema_update = true
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9254,
|
||||
.description = "2024_01_13_merchantlist_temp_slot.sql",
|
||||
.check = "SHOW COLUMNS FROM `merchantlist_temp` LIKE 'slot'",
|
||||
.condition = "contains",
|
||||
.match = "tinyint",
|
||||
.sql = R"(
|
||||
ALTER TABLE `merchantlist_temp`
|
||||
MODIFY COLUMN `slot` int(11) UNSIGNED NOT NULL DEFAULT 0
|
||||
)"
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9255,
|
||||
.description = "2024_01_13_drop_item_tick_deprecated.sql",
|
||||
.check = "show tables like 'item_tick'",
|
||||
.condition = "not_empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
DROP TABLE IF EXISTS item_tick
|
||||
)"
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9256,
|
||||
.description = "2024_01_16_increase_spawngroup_size.sql",
|
||||
.check = "SHOW COLUMNS FROM `spawngroup` LIKE 'name'",
|
||||
.condition = "contains",
|
||||
.match = "varchar(50)",
|
||||
.sql = R"(
|
||||
ALTER TABLE `spawngroup`
|
||||
MODIFY COLUMN `name` varchar(200) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' AFTER `id`;
|
||||
)"
|
||||
}
|
||||
|
||||
// -- template; copy/paste this when you need to create a new entry
|
||||
// ManifestEntry{
|
||||
// .version = 9228,
|
||||
|
||||
@@ -82,6 +82,28 @@ CREATE TABLE `bot_starting_items` (
|
||||
`content_flags_disabled` varchar(100) CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE = InnoDB CHARACTER SET = latin1 COLLATE = latin1_swedish_ci;
|
||||
)",
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9041,
|
||||
.description = "2023_12_04_bot_timers.sql",
|
||||
.check = "SHOW COLUMNS FROM `bot_timers` LIKE 'recast_time'",
|
||||
.condition = "empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
ALTER TABLE `bot_timers`
|
||||
ADD COLUMN `recast_time` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `timer_value`,
|
||||
ADD COLUMN `is_spell` TINYINT(2) UNSIGNED NOT NULL DEFAULT 0 AFTER `recast_time`,
|
||||
ADD COLUMN `is_disc` TINYINT(2) UNSIGNED NOT NULL DEFAULT 0 AFTER `is_spell`,
|
||||
ADD COLUMN `spell_id` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `is_disc`,
|
||||
ADD COLUMN `is_item` TINYINT(2) UNSIGNED NOT NULL DEFAULT 0 AFTER `spell_id`,
|
||||
ADD COLUMN `item_id` INT(11) UNSIGNED NOT NULL DEFAULT '0' AFTER `is_item`;
|
||||
ALTER TABLE `bot_timers`
|
||||
DROP FOREIGN KEY `FK_bot_timers_1`;
|
||||
ALTER TABLE `bot_timers`
|
||||
DROP PRIMARY KEY;
|
||||
ALTER TABLE `bot_timers`
|
||||
ADD PRIMARY KEY (`bot_id`, `timer_id`, `spell_id`, `item_id`);
|
||||
)"
|
||||
}
|
||||
// -- template; copy/paste this when you need to create a new entry
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
#include "../common/global_define.h"
|
||||
#include "../common/rulesys.h"
|
||||
#include "../common/strings.h"
|
||||
|
||||
#include "database.h"
|
||||
#include "database/database_update.h"
|
||||
|
||||
|
||||
// Disgrace: for windows compile
|
||||
#ifdef _WINDOWS
|
||||
#include <windows.h>
|
||||
#define snprintf _snprintf
|
||||
#define strncasecmp _strnicmp
|
||||
#define strcasecmp _stricmp
|
||||
#else
|
||||
|
||||
#include "unix.h"
|
||||
#include <netinet/in.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#endif
|
||||
|
||||
#pragma pack(1)
|
||||
|
||||
DatabaseUpdate database_update;
|
||||
|
||||
bool Database::CheckDatabaseConversions()
|
||||
{
|
||||
auto *r = RuleManager::Instance();
|
||||
r->LoadRules(this, "default", false);
|
||||
if (!RuleB(Bots, Enabled) && DoesTableExist("bot_data")) {
|
||||
LogInfo("Bot tables found but rule not enabled, enabling");
|
||||
r->SetRule("Bots:Enabled", "true", this, true, true);
|
||||
}
|
||||
|
||||
database_update.SetDatabase(this)->CheckDbUpdates();
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ namespace DatabaseSchema {
|
||||
{"character_tasks", "charid"},
|
||||
{"character_tribute", "character_id"},
|
||||
{"completed_tasks", "charid"},
|
||||
{"data_buckets", "id"},
|
||||
{"data_buckets", "character_id"},
|
||||
{"faction_values", "char_id"},
|
||||
{"friends", "charid"},
|
||||
{"guild_members", "char_id"},
|
||||
|
||||
+1
-2
@@ -8,7 +8,6 @@
|
||||
|
||||
#include "dbcore.h"
|
||||
|
||||
#include <errmsg.h>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <mysqld_error.h>
|
||||
@@ -138,7 +137,7 @@ MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, boo
|
||||
* Error logging
|
||||
*/
|
||||
if (mysql_errno(mysql) > 0 && query[0] != '\0') {
|
||||
LogMySQLError("[{}] [{}]\n[{}]", mysql_errno(mysql), mysql_error(mysql), query);
|
||||
LogMySQLError("MySQL Error ({}) [{}] Query [{}]", mysql_errno(mysql), mysql_error(mysql), query);
|
||||
}
|
||||
|
||||
return MySQLRequestResult(nullptr, 0, 0, 0, 0, mysql_errno(mysql), errorBuffer);
|
||||
|
||||
@@ -14,6 +14,9 @@
|
||||
#include <string.h>
|
||||
#include <mutex>
|
||||
|
||||
#define CR_SERVER_GONE_ERROR 2006
|
||||
#define CR_SERVER_LOST 2013
|
||||
|
||||
class DBcore {
|
||||
public:
|
||||
enum eStatus {
|
||||
|
||||
+94
-35
@@ -22,7 +22,6 @@
|
||||
#include "data_verification.h"
|
||||
#include "eqemu_logsys.h"
|
||||
#include "eqemu_logsys_log_aliases.h"
|
||||
#include "languages.h"
|
||||
#include "rulesys.h"
|
||||
|
||||
int16 EQ::invtype::GetInvTypeSize(int16 inv_type) {
|
||||
@@ -159,45 +158,45 @@ int EQ::constants::ConvertStanceTypeToIndex(StanceType stance_type) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const std::map<int, std::string>& EQ::constants::GetLanguageMap()
|
||||
const std::map<uint8, std::string>& EQ::constants::GetLanguageMap()
|
||||
{
|
||||
static const std::map<int, std::string> language_map = {
|
||||
{ LANG_COMMON_TONGUE, "Common Tongue" },
|
||||
{ LANG_BARBARIAN, "Barbarian" },
|
||||
{ LANG_ERUDIAN, "Erudian" },
|
||||
{ LANG_ELVISH, "Elvish" },
|
||||
{ LANG_DARK_ELVISH, "Dark Elvish" },
|
||||
{ LANG_DWARVISH, "Dwarvish" },
|
||||
{ LANG_TROLL, "Troll" },
|
||||
{ LANG_OGRE, "Ogre" },
|
||||
{ LANG_GNOMISH, "Gnomish" },
|
||||
{ LANG_HALFLING, "Halfling" },
|
||||
{ LANG_THIEVES_CANT, "Thieves Cant" },
|
||||
{ LANG_OLD_ERUDIAN, "Old Erudian" },
|
||||
{ LANG_ELDER_ELVISH, "Elder Elvish" },
|
||||
{ LANG_FROGLOK, "Froglok" },
|
||||
{ LANG_GOBLIN, "Goblin" },
|
||||
{ LANG_GNOLL, "Gnoll" },
|
||||
{ LANG_COMBINE_TONGUE, "Combine Tongue" },
|
||||
{ LANG_ELDER_TEIRDAL, "Elder Teirdal" },
|
||||
{ LANG_LIZARDMAN, "Lizardman" },
|
||||
{ LANG_ORCISH, "Orcish" },
|
||||
{ LANG_FAERIE, "Faerie" },
|
||||
{ LANG_DRAGON, "Dragon" },
|
||||
{ LANG_ELDER_DRAGON, "Elder Dragon" },
|
||||
{ LANG_DARK_SPEECH, "Dark Speech" },
|
||||
{ LANG_VAH_SHIR, "Vah Shir" },
|
||||
{ LANG_ALARAN, "Alaran" },
|
||||
{ LANG_HADAL, "Hadal" },
|
||||
{ LANG_UNKNOWN, "Unknown" }
|
||||
static const std::map<uint8, std::string> language_map = {
|
||||
{ Language::CommonTongue, "Common Tongue" },
|
||||
{ Language::Barbarian, "Barbarian" },
|
||||
{ Language::Erudian, "Erudian" },
|
||||
{ Language::Elvish, "Elvish" },
|
||||
{ Language::DarkElvish, "Dark Elvish" },
|
||||
{ Language::Dwarvish, "Dwarvish" },
|
||||
{ Language::Troll, "Troll" },
|
||||
{ Language::Ogre, "Ogre" },
|
||||
{ Language::Gnomish, "Gnomish" },
|
||||
{ Language::Halfling, "Halfling" },
|
||||
{ Language::ThievesCant, "Thieves Cant" },
|
||||
{ Language::OldErudian, "Old Erudian" },
|
||||
{ Language::ElderElvish, "Elder Elvish" },
|
||||
{ Language::Froglok, "Froglok" },
|
||||
{ Language::Goblin, "Goblin" },
|
||||
{ Language::Gnoll, "Gnoll" },
|
||||
{ Language::CombineTongue, "Combine Tongue" },
|
||||
{ Language::ElderTeirDal, "Elder Teir'Dal" },
|
||||
{ Language::Lizardman, "Lizardman" },
|
||||
{ Language::Orcish, "Orcish" },
|
||||
{ Language::Faerie, "Faerie" },
|
||||
{ Language::Dragon, "Dragon" },
|
||||
{ Language::ElderDragon, "Elder Dragon" },
|
||||
{ Language::DarkSpeech, "Dark Speech" },
|
||||
{ Language::VahShir, "Vah Shir" },
|
||||
{ Language::Alaran, "Alaran" },
|
||||
{ Language::Hadal, "Hadal" },
|
||||
{ Language::Unknown27, "Unknown" }
|
||||
};
|
||||
|
||||
return language_map;
|
||||
}
|
||||
|
||||
std::string EQ::constants::GetLanguageName(int language_id)
|
||||
std::string EQ::constants::GetLanguageName(uint8 language_id)
|
||||
{
|
||||
if (!EQ::ValueWithin(language_id, LANG_COMMON_TONGUE, LANG_UNKNOWN)) {
|
||||
if (!EQ::ValueWithin(language_id, Language::CommonTongue, Language::Unknown27)) {
|
||||
return std::string();
|
||||
}
|
||||
|
||||
@@ -509,7 +508,6 @@ std::string EQ::constants::GetObjectTypeName(int object_type)
|
||||
{
|
||||
if (!EQ::ValueWithin(object_type, ObjectTypes::SmallBag, ObjectTypes::NoDeposit)) {
|
||||
return std::string();
|
||||
|
||||
}
|
||||
|
||||
return EQ::constants::GetObjectTypeMap().find(object_type)->second;
|
||||
@@ -564,6 +562,7 @@ std::string EQ::constants::GetEmoteEventTypeName(uint8 emote_event_type)
|
||||
const std::map<uint8, std::string> &EQ::constants::GetEmoteTypeMap()
|
||||
{
|
||||
static const std::map<uint8, std::string> emote_type_map = {
|
||||
{ EmoteTypes::Say, "Say" },
|
||||
{ EmoteTypes::Emote, "Emote" },
|
||||
{ EmoteTypes::Shout, "Shout" },
|
||||
{ EmoteTypes::Proximity, "Proximity" }
|
||||
@@ -574,9 +573,69 @@ const std::map<uint8, std::string> &EQ::constants::GetEmoteTypeMap()
|
||||
|
||||
std::string EQ::constants::GetEmoteTypeName(uint8 emote_type)
|
||||
{
|
||||
if (!EQ::ValueWithin(emote_type, EmoteTypes::Emote, EmoteTypes::Proximity)) {
|
||||
if (!EQ::ValueWithin(emote_type, EmoteTypes::Say, EmoteTypes::Proximity)) {
|
||||
return std::string();
|
||||
}
|
||||
|
||||
return EQ::constants::GetEmoteTypeMap().find(emote_type)->second;
|
||||
}
|
||||
|
||||
const std::map<uint32, std::string>& EQ::constants::GetAppearanceTypeMap()
|
||||
{
|
||||
static const std::map<uint32, std::string> appearance_type_map = {
|
||||
{ AppearanceType::Die, "Die" },
|
||||
{ AppearanceType::WhoLevel, "Who Level" },
|
||||
{ AppearanceType::MaxHealth, "Max Health" },
|
||||
{ AppearanceType::Invisibility, "Invisibility" },
|
||||
{ AppearanceType::PVP, "PVP" },
|
||||
{ AppearanceType::Light, "Light" },
|
||||
{ AppearanceType::Animation, "Animation" },
|
||||
{ AppearanceType::Sneak, "Sneak" },
|
||||
{ AppearanceType::SpawnID, "Spawn ID" },
|
||||
{ AppearanceType::Health, "Health" },
|
||||
{ AppearanceType::Linkdead, "Linkdead" },
|
||||
{ AppearanceType::FlyMode, "Fly Mode" },
|
||||
{ AppearanceType::GM, "GM" },
|
||||
{ AppearanceType::Anonymous, "Anonymous" },
|
||||
{ AppearanceType::GuildID, "Guild ID" },
|
||||
{ AppearanceType::GuildRank, "Guild Rank" },
|
||||
{ AppearanceType::AFK, "AFK" },
|
||||
{ AppearanceType::Pet, "Pet" },
|
||||
{ AppearanceType::Summoned, "Summoned" },
|
||||
{ AppearanceType::Split, "Split" },
|
||||
{ AppearanceType::Size, "Size" },
|
||||
{ AppearanceType::SetType, "Set Type" },
|
||||
{ AppearanceType::NPCName, "NPCName" },
|
||||
{ AppearanceType::AARank, "AARank" },
|
||||
{ AppearanceType::CancelSneakHide, "Cancel Sneak Hide" },
|
||||
{ AppearanceType::AreaHealthRegen, "Area Health Regeneration" },
|
||||
{ AppearanceType::AreaManaRegen, "Area Mana Regeneration" },
|
||||
{ AppearanceType::AreaEnduranceRegen, "Area Endurance Regeneration" },
|
||||
{ AppearanceType::FreezeBeneficialBuffs, "Freeze Beneficial Buffs" },
|
||||
{ AppearanceType::NPCTintIndex, "NPC Tint Index" },
|
||||
{ AppearanceType::GroupAutoConsent, "Group Auto Consent" },
|
||||
{ AppearanceType::RaidAutoConsent, "Raid Auto Consent" },
|
||||
{ AppearanceType::GuildAutoConsent, "Guild Auto Consent" },
|
||||
{ AppearanceType::ShowHelm, "Show Helm" },
|
||||
{ AppearanceType::DamageState, "Damage State" },
|
||||
{ AppearanceType::EQPlayers, "EQ Players" },
|
||||
{ AppearanceType::FindBits, "Find Bits" },
|
||||
{ AppearanceType::TextureType, "Texture Type" },
|
||||
{ AppearanceType::FacePick, "Face Pick" },
|
||||
{ AppearanceType::AntiCheat, "Anti Cheat" },
|
||||
{ AppearanceType::GuildShow, "Guild Show" },
|
||||
{ AppearanceType::OfflineMode, "Offline Mode" }
|
||||
};
|
||||
|
||||
return appearance_type_map;
|
||||
}
|
||||
|
||||
std::string EQ::constants::GetAppearanceTypeName(uint32 appearance_type)
|
||||
{
|
||||
const auto& a = EQ::constants::GetAppearanceTypeMap().find(appearance_type);
|
||||
if (a != EQ::constants::GetAppearanceTypeMap().end()) {
|
||||
return a->second;
|
||||
}
|
||||
|
||||
return std::string();
|
||||
}
|
||||
|
||||
@@ -350,6 +350,7 @@ namespace EQ
|
||||
};
|
||||
|
||||
enum EmoteTypes : uint8 {
|
||||
Say,
|
||||
Emote,
|
||||
Shout,
|
||||
Proximity
|
||||
@@ -358,8 +359,8 @@ namespace EQ
|
||||
const char *GetStanceName(StanceType stance_type);
|
||||
int ConvertStanceTypeToIndex(StanceType stance_type);
|
||||
|
||||
extern const std::map<int, std::string>& GetLanguageMap();
|
||||
std::string GetLanguageName(int language_id);
|
||||
extern const std::map<uint8, std::string>& GetLanguageMap();
|
||||
std::string GetLanguageName(uint8 language_id);
|
||||
|
||||
extern const std::map<uint32, std::string>& GetLDoNThemeMap();
|
||||
std::string GetLDoNThemeName(uint32 theme_id);
|
||||
@@ -397,6 +398,9 @@ namespace EQ
|
||||
extern const std::map<uint8, std::string>& GetEmoteTypeMap();
|
||||
std::string GetEmoteTypeName(uint8 emote_type);
|
||||
|
||||
extern const std::map<uint32, std::string>& GetAppearanceTypeMap();
|
||||
std::string GetAppearanceTypeName(uint32 animation_type);
|
||||
|
||||
const int STANCE_TYPE_FIRST = stancePassive;
|
||||
const int STANCE_TYPE_LAST = stanceBurnAE;
|
||||
const int STANCE_TYPE_COUNT = stanceBurnAE;
|
||||
|
||||
+99
-54
@@ -23,61 +23,59 @@
|
||||
#include "skills.h"
|
||||
#include "types.h"
|
||||
|
||||
namespace AppearanceType {
|
||||
constexpr uint32 Die = 0; // Causes the client to keel over and zone to bind point (default action)
|
||||
constexpr uint32 WhoLevel = 1; // Level that shows up on /who
|
||||
constexpr uint32 MaxHealth = 2;
|
||||
constexpr uint32 Invisibility = 3; // 0 = Visible, 1 = Invisible
|
||||
constexpr uint32 PVP = 4; // 0 = Non-PVP, 1 = PVP
|
||||
constexpr uint32 Light = 5; // Light type emitted by player (lightstone, shiny shield)
|
||||
constexpr uint32 Animation = 14; // 100 = Standing, 102 = Freeze, 105 = Looting, 110 = Sitting, 111 = Crouching, 115 = Lying
|
||||
constexpr uint32 Sneak = 15; // 0 = Normal, 1 = Sneaking
|
||||
constexpr uint32 SpawnID = 16; // Server -> Client, sets player spawn ID
|
||||
constexpr uint32 Health = 17; // Client->Server, my HP has changed (like regen tic)
|
||||
constexpr uint32 Linkdead = 18; // 0 = Normal, 1 = Linkdead
|
||||
constexpr uint32 FlyMode = 19; // 0 = Off, 1 = Flying, 2 = Levitating, 3 = Water, 4 = Floating, 5 = Levitating while Running
|
||||
constexpr uint32 GM = 20; // 0 = Non-GM, 1 = GM
|
||||
constexpr uint32 Anonymous = 21; // 0 = Non-Anonymous, 1 = Anonymous, 2 = Roleplaying
|
||||
constexpr uint32 GuildID = 22;
|
||||
constexpr uint32 GuildRank = 23;
|
||||
constexpr uint32 AFK = 24; // 0 = Non-AFK, 1 = AFK
|
||||
constexpr uint32 Pet = 25; // Parameter is Entity ID of owner, or 0 for when charm breaks
|
||||
constexpr uint32 Summoned = 27;
|
||||
constexpr uint32 Split = 28; // 0 = No Split, 1 = Auto Split
|
||||
constexpr uint32 Size = 29; // Spawn's Size
|
||||
constexpr uint32 SetType = 30; // 0 = PC, 1 = NPC, 2 = Corpse
|
||||
constexpr uint32 NPCName = 31; // Change PC name color to NPC name color
|
||||
constexpr uint32 AARank = 32; // AA Rank Title ID, title in /who?
|
||||
constexpr uint32 CancelSneakHide = 33; // Turns off Hide and Sneak
|
||||
constexpr uint32 AreaHealthRegen = 35; // Guild Hall Regeneration Pool sets to value * 0.001
|
||||
constexpr uint32 AreaManaRegen = 36; // Guild Hall Regeneration Pool sets to value * 0.001
|
||||
constexpr uint32 AreaEnduranceRegen = 37; // Guild Hall Regeneration Pool sets to value * 0.001
|
||||
constexpr uint32 FreezeBeneficialBuffs = 38; // Freezes beneficial buff timers for PCs
|
||||
constexpr uint32 NPCTintIndex = 39;
|
||||
constexpr uint32 GroupAutoConsent = 40; // Auto Consent Group
|
||||
constexpr uint32 RaidAutoConsent = 41; // Auto Consent Raid
|
||||
constexpr uint32 GuildAutoConsent = 42; // Auto Consent Guild
|
||||
constexpr uint32 ShowHelm = 43; // 0 = Hide, 1 = Show
|
||||
constexpr uint32 DamageState = 44; // The damage state of a destructible object (0 through 10) plays sound IDs, most only have 2 or 4 states though
|
||||
constexpr uint32 EQPlayers = 45; // EQ Players Update
|
||||
constexpr uint32 FindBits = 46; // Set Find Bits?
|
||||
constexpr uint32 TextureType = 48; // Texture Type?
|
||||
constexpr uint32 FacePick = 49; // Turns off face pick window?
|
||||
constexpr uint32 AntiCheat = 51; // Sent by the client randomly telling the server how long since last action has occurred
|
||||
constexpr uint32 GuildShow = 52;
|
||||
constexpr uint32 OfflineMode = 53; // Offline Mode
|
||||
}
|
||||
|
||||
//SpawnAppearance types: (compared two clients for server-originating types: SoF & RoF2)
|
||||
#define AT_Die 0 // this causes the client to keel over and zone to bind point (default action)
|
||||
#define AT_WhoLevel 1 // the level that shows up on /who
|
||||
#define AT_HPMax 2 // idk
|
||||
#define AT_Invis 3 // 0 = visible, 1 = invisible
|
||||
#define AT_PVP 4 // 0 = blue, 1 = pvp (red)
|
||||
#define AT_Light 5 // light type emitted by player (lightstone, shiny shield)
|
||||
#define AT_Anim 14 // 100=standing, 110=sitting, 111=ducking, 115=feigned, 105=looting
|
||||
#define AT_Sneak 15 // 0 = normal, 1 = sneaking
|
||||
#define AT_SpawnID 16 // server to client, sets player spawn id
|
||||
#define AT_HP 17 // Client->Server, my HP has changed (like regen tic)
|
||||
#define AT_Linkdead 18 // 0 = normal, 1 = linkdead
|
||||
#define AT_Levitate 19 // 0=off, 1=flymode, 2=levitate max 5, see GravityBehavior enum
|
||||
#define AT_GM 20 // 0 = normal, 1 = GM - all odd numbers seem to make it GM
|
||||
#define AT_Anon 21 // 0 = normal, 1 = anon, 2 = roleplay
|
||||
#define AT_GuildID 22
|
||||
#define AT_GuildRank 23 // 0=member, 1=officer, 2=leader
|
||||
#define AT_AFK 24 // 0 = normal, 1 = afk
|
||||
#define AT_Pet 25 // Param is EntityID of owner, or 0 for when charm breaks
|
||||
#define AT_Summoned 27 // Unsure
|
||||
#define AT_Split 28 // 0 = normal, 1 = autosplit on (not showing in SoF+) (client-to-server only)
|
||||
#define AT_Size 29 // spawn's size (present: SoF, absent: RoF2)
|
||||
#define AT_SetType 30 // 0 = PC, 1 = NPC, 2 <= = corpse
|
||||
#define AT_NPCName 31 // change PC's name's color to NPC color 0 = normal, 1 = npc name, Trader on RoF2?
|
||||
#define AT_AARank 32 // AA Rank Title ID thingy, does is this the title in /who?
|
||||
#define AT_CancelSneakHide 33 // Turns off Hide and Sneak
|
||||
//#define AT_34 34 // unknown (present: SoF, absent: RoF2)
|
||||
#define AT_AreaHPRegen 35 // guild hall regen pool sets to value * 0.001
|
||||
#define AT_AreaManaRegen 36 // guild hall regen pool sets to value * 0.001
|
||||
#define AT_AreaEndRegen 37 // guild hall regen pool sets to value * 0.001
|
||||
#define AT_FreezeBuffs 38 // Freezes beneficial buff timers
|
||||
#define AT_NpcTintIndex 39 // not 100% sure
|
||||
#define AT_GroupConsent 40 // auto consent group
|
||||
#define AT_RaidConsent 41 // auto consent raid
|
||||
#define AT_GuildConsent 42 // auto consent guild
|
||||
#define AT_ShowHelm 43 // 0 = hide graphic, 1 = show graphic
|
||||
#define AT_DamageState 44 // The damage state of a destructible object (0 through 10) plays soundids most only have 2 or 4 states though
|
||||
#define AT_EQPlayers 45 // /eqplayersupdate
|
||||
#define AT_FindBits 46 // set FindBits, whatever those are!
|
||||
#define AT_TextureType 48 // TextureType
|
||||
#define AT_FacePick 49 // Turns off face pick window? maybe ...
|
||||
#define AT_AntiCheat 51 // sent by the client randomly telling the server how long since last action has occured
|
||||
#define AT_GuildShow 52 // this is what MQ2 call sit, not sure
|
||||
#define AT_Offline 53 // Offline mode
|
||||
|
||||
//#define AT_Trader 300 // Bazaar Trader Mode (not present in SoF or RoF2)
|
||||
|
||||
// animations for AT_Anim
|
||||
#define ANIM_FREEZE 102
|
||||
#define ANIM_STAND 0x64
|
||||
#define ANIM_SIT 0x6e
|
||||
#define ANIM_CROUCH 0x6f
|
||||
#define ANIM_DEATH 0x73
|
||||
#define ANIM_LOOT 0x69
|
||||
namespace Animation {
|
||||
constexpr uint32 Standing = 100;
|
||||
constexpr uint32 Freeze = 102;
|
||||
constexpr uint32 Looting = 105;
|
||||
constexpr uint32 Sitting = 110;
|
||||
constexpr uint32 Crouching = 111;
|
||||
constexpr uint32 Lying = 115;
|
||||
}
|
||||
|
||||
constexpr int16 RECAST_TYPE_UNLINKED_ITEM = -1;
|
||||
|
||||
@@ -686,6 +684,53 @@ namespace Zones {
|
||||
constexpr uint16 APPRENTICE = 999; // Designer Apprentice
|
||||
}
|
||||
|
||||
namespace Language {
|
||||
constexpr uint8 CommonTongue = 0;
|
||||
constexpr uint8 Barbarian = 1;
|
||||
constexpr uint8 Erudian = 2;
|
||||
constexpr uint8 Elvish = 3;
|
||||
constexpr uint8 DarkElvish = 4;
|
||||
constexpr uint8 Dwarvish = 5;
|
||||
constexpr uint8 Troll = 6;
|
||||
constexpr uint8 Ogre = 7;
|
||||
constexpr uint8 Gnomish = 8;
|
||||
constexpr uint8 Halfling = 9;
|
||||
constexpr uint8 ThievesCant = 10;
|
||||
constexpr uint8 OldErudian = 11;
|
||||
constexpr uint8 ElderElvish = 12;
|
||||
constexpr uint8 Froglok = 13;
|
||||
constexpr uint8 Goblin = 14;
|
||||
constexpr uint8 Gnoll = 15;
|
||||
constexpr uint8 CombineTongue = 16;
|
||||
constexpr uint8 ElderTeirDal = 17;
|
||||
constexpr uint8 Lizardman = 18;
|
||||
constexpr uint8 Orcish = 19;
|
||||
constexpr uint8 Faerie = 20;
|
||||
constexpr uint8 Dragon = 21;
|
||||
constexpr uint8 ElderDragon = 22;
|
||||
constexpr uint8 DarkSpeech = 23;
|
||||
constexpr uint8 VahShir = 24;
|
||||
constexpr uint8 Alaran = 25;
|
||||
constexpr uint8 Hadal = 26;
|
||||
constexpr uint8 Unknown27 = 27;
|
||||
|
||||
constexpr uint8 MaxValue = 100;
|
||||
}
|
||||
namespace PetInfoType {
|
||||
constexpr int Current = 0;
|
||||
constexpr int Suspended = 1;
|
||||
}
|
||||
|
||||
namespace BuffEffectType {
|
||||
constexpr uint8 None = 0;
|
||||
constexpr uint8 Buff = 2;
|
||||
constexpr uint8 InverseBuff = 4;
|
||||
}
|
||||
|
||||
namespace AlternateCurrencyMode {
|
||||
constexpr uint32 Update = 7;
|
||||
constexpr uint32 Populate = 8;
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
FilterNone = 0,
|
||||
|
||||
@@ -124,6 +124,12 @@ struct LDoNTrapTemplate
|
||||
uint8 locked;
|
||||
};
|
||||
|
||||
enum CrystalReclaimTypes
|
||||
{
|
||||
Ebon = 5,
|
||||
Radiant = 4,
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
@@ -386,7 +392,7 @@ struct NewZone_Struct {
|
||||
/*0724*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, if this value is 0, it prevents you from running off edges that would end up underworld
|
||||
/*0728*/ uint32 lava_damage; // Seen 50
|
||||
/*0732*/ uint32 min_lava_damage; // Seen 10
|
||||
/*0736*/
|
||||
/*0736*/ float safe_heading;
|
||||
};
|
||||
|
||||
/*
|
||||
@@ -625,6 +631,12 @@ struct ConsentResponse_Struct {
|
||||
char zonename[32];
|
||||
};
|
||||
|
||||
struct NameApproval_Struct {
|
||||
char name[64];
|
||||
uint32 race_id;
|
||||
uint32 class_id;
|
||||
};
|
||||
|
||||
/*
|
||||
** Name Generator Struct
|
||||
** Length: 72 bytes
|
||||
@@ -3439,7 +3451,7 @@ struct Make_Pet_Struct { //Simple struct for getting pet info
|
||||
uint32 min_dmg;
|
||||
uint32 max_dmg;
|
||||
};
|
||||
struct Ground_Spawn{
|
||||
struct GroundSpawn{
|
||||
float max_x;
|
||||
float max_y;
|
||||
float min_x;
|
||||
@@ -3451,8 +3463,8 @@ struct Ground_Spawn{
|
||||
uint32 max_allowed;
|
||||
uint32 respawntimer;
|
||||
};
|
||||
struct Ground_Spawns {
|
||||
struct Ground_Spawn spawn[50]; //Assigned max number to allow
|
||||
struct GroundSpawns {
|
||||
struct GroundSpawn spawn[50]; //Assigned max number to allow
|
||||
};
|
||||
|
||||
//struct PetitionBug_Struct{
|
||||
@@ -5128,8 +5140,6 @@ struct GroupMakeLeader_Struct
|
||||
//ex for a blank crowns window you would send:
|
||||
//999999|1|999999|0
|
||||
//any items come after in much the same way adventure merchant items do except there is no theme included
|
||||
#define ALT_CURRENCY_OP_POPULATE 8
|
||||
#define ALT_CURRENCY_OP_UPDATE 7
|
||||
|
||||
//Server -> Client
|
||||
//Populates the initial Alternate Currency Window
|
||||
|
||||
+110
-15
@@ -20,9 +20,12 @@
|
||||
#include "eqemu_config.h"
|
||||
#include "misc_functions.h"
|
||||
#include "strings.h"
|
||||
#include "eqemu_logsys.h"
|
||||
#include "json/json.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <filesystem>
|
||||
|
||||
std::string EQEmuConfig::ConfigFile = "eqemu_config.json";
|
||||
EQEmuConfig *EQEmuConfig::_config = nullptr;
|
||||
@@ -111,13 +114,12 @@ void EQEmuConfig::parse_config()
|
||||
DisableConfigChecks = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* UCS
|
||||
*/
|
||||
ChatHost = _root["server"]["chatserver"].get("host", "eqchat.eqemulator.net").asString();
|
||||
ChatPort = Strings::ToUnsignedInt(_root["server"]["chatserver"].get("port", "7778").asString());
|
||||
MailHost = _root["server"]["mailserver"].get("host", "eqmail.eqemulator.net").asString();
|
||||
MailPort = Strings::ToUnsignedInt(_root["server"]["mailserver"].get("port", "7778").asString());
|
||||
|
||||
|
||||
CheckUcsConfigConversion();
|
||||
|
||||
m_ucs_host = _root["server"]["ucs"].get("host", "eqchat.eqemulator.net").asString();
|
||||
m_ucs_port = Strings::ToUnsignedInt(_root["server"]["ucs"].get("port", "7778").asString());
|
||||
|
||||
/**
|
||||
* Database
|
||||
@@ -246,16 +248,16 @@ std::string EQEmuConfig::GetByName(const std::string &var_name) const
|
||||
return (WorldHTTPEnabled ? "true" : "false");
|
||||
}
|
||||
if (var_name == "ChatHost") {
|
||||
return (ChatHost);
|
||||
return (m_ucs_host);
|
||||
}
|
||||
if (var_name == "ChatPort") {
|
||||
return (itoa(ChatPort));
|
||||
return (itoa(m_ucs_port));
|
||||
}
|
||||
if (var_name == "MailHost") {
|
||||
return (MailHost);
|
||||
return (m_ucs_host);
|
||||
}
|
||||
if (var_name == "MailPort") {
|
||||
return (itoa(MailPort));
|
||||
return (itoa(m_ucs_port));
|
||||
}
|
||||
if (var_name == "DatabaseHost") {
|
||||
return (DatabaseHost);
|
||||
@@ -362,10 +364,8 @@ void EQEmuConfig::Dump() const
|
||||
std::cout << "WorldHTTPPort = " << WorldHTTPPort << std::endl;
|
||||
std::cout << "WorldHTTPMimeFile = " << WorldHTTPMimeFile << std::endl;
|
||||
std::cout << "WorldHTTPEnabled = " << WorldHTTPEnabled << std::endl;
|
||||
std::cout << "ChatHost = " << ChatHost << std::endl;
|
||||
std::cout << "ChatPort = " << ChatPort << std::endl;
|
||||
std::cout << "MailHost = " << MailHost << std::endl;
|
||||
std::cout << "MailPort = " << MailPort << std::endl;
|
||||
std::cout << "UCSHost = " << m_ucs_host << std::endl;
|
||||
std::cout << "UCSPort = " << m_ucs_port << std::endl;
|
||||
std::cout << "DatabaseHost = " << DatabaseHost << std::endl;
|
||||
std::cout << "DatabaseUsername = " << DatabaseUsername << std::endl;
|
||||
std::cout << "DatabasePassword = " << DatabasePassword << std::endl;
|
||||
@@ -392,3 +392,98 @@ void EQEmuConfig::Dump() const
|
||||
std::cout << "DefaultStatus = " << (int) DefaultStatus << std::endl;
|
||||
// std::cout << "DynamicCount = " << DynamicCount << std::endl;
|
||||
}
|
||||
|
||||
const std::string &EQEmuConfig::GetUCSHost() const
|
||||
{
|
||||
return m_ucs_host;
|
||||
}
|
||||
|
||||
uint16 EQEmuConfig::GetUCSPort() const
|
||||
{
|
||||
return m_ucs_port;
|
||||
}
|
||||
|
||||
void EQEmuConfig::CheckUcsConfigConversion()
|
||||
{
|
||||
std::string chat_host = _root["server"]["chatserver"].get("host", "").asString();
|
||||
uint32 chat_port = Strings::ToUnsignedInt(_root["server"]["chatserver"].get("port", "0").asString());
|
||||
std::string mail_host = _root["server"]["mailserver"].get("host", "").asString();
|
||||
uint32 mail_port = Strings::ToUnsignedInt(_root["server"]["mailserver"].get("port", "0").asString());
|
||||
std::string ucs_host = _root["server"]["ucs"].get("host", "").asString();
|
||||
|
||||
// automatic ucs legacy configuration migration
|
||||
// if old configuration values are set, let's backup the existing configuration
|
||||
// and migrate to to use the new fields and write the new config
|
||||
if ((!chat_host.empty() || !mail_host.empty()) && ucs_host.empty()) {
|
||||
LogInfo("Migrating old [eqemu_config] UCS configuration to new configuration");
|
||||
|
||||
std::string config_file_path = std::filesystem::path{
|
||||
path.GetServerPath() + "/eqemu_config.json"
|
||||
}.string();
|
||||
|
||||
std::string config_file_bak_path = std::filesystem::path{
|
||||
path.GetServerPath() + "/eqemu_config.ucs-migrate-json.bak"
|
||||
}.string();
|
||||
|
||||
// copy eqemu_config.json to eqemu_config.json.bak
|
||||
std::ifstream src(config_file_path, std::ios::binary);
|
||||
std::ofstream dst(config_file_bak_path, std::ios::binary);
|
||||
dst << src.rdbuf();
|
||||
src.close();
|
||||
|
||||
LogInfo("Old configuration backed up to [{}]", config_file_bak_path);
|
||||
|
||||
// read eqemu_config.json, transplant new fields and write to eqemu_config.json
|
||||
Json::Value root;
|
||||
Json::Reader reader;
|
||||
std::ifstream file(config_file_path);
|
||||
if (!reader.parse(file, root)) {
|
||||
LogError("Failed to parse configuration file");
|
||||
return;
|
||||
}
|
||||
file.close();
|
||||
|
||||
// get old fields
|
||||
std::string host = !chat_host.empty() ? chat_host : mail_host;
|
||||
if (host.empty()) {
|
||||
host = "eqchat.eqemulator.net";
|
||||
}
|
||||
std::string port = chat_port > 0 ? std::to_string(chat_port) : std::to_string(mail_port);
|
||||
if (port.empty()) {
|
||||
port = "7778";
|
||||
}
|
||||
|
||||
// set new fields
|
||||
root["server"]["ucs"]["host"] = host;
|
||||
root["server"]["ucs"]["port"] = port;
|
||||
|
||||
// unset old fields
|
||||
root["server"].removeMember("chatserver");
|
||||
root["server"].removeMember("mailserver");
|
||||
|
||||
// get Json::Value raw string
|
||||
std::string config = root.toStyledString();
|
||||
|
||||
// format using more modern json library
|
||||
nlohmann::json data = nlohmann::json::parse(config);
|
||||
|
||||
// write to file
|
||||
std::ofstream o(config_file_path);
|
||||
o << std::setw(1) << data << std::endl;
|
||||
o.close();
|
||||
|
||||
// write new config
|
||||
LogInfo("New configuration written to [{}]", config_file_path);
|
||||
LogInfo("Migration complete, please review the new configuration file");
|
||||
|
||||
// reload config internally
|
||||
try {
|
||||
std::ifstream fconfig(config_file_path, std::ifstream::binary);
|
||||
fconfig >> _config->_root;
|
||||
_config->parse_config();
|
||||
}
|
||||
catch (std::exception &) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,14 +62,6 @@ class EQEmuConfig
|
||||
std::string SharedKey;
|
||||
bool DisableConfigChecks;
|
||||
|
||||
// From <chatserver/>
|
||||
std::string ChatHost;
|
||||
uint16 ChatPort;
|
||||
|
||||
// From <mailserver/>
|
||||
std::string MailHost;
|
||||
uint16 MailPort;
|
||||
|
||||
// From <database/>
|
||||
std::string DatabaseHost;
|
||||
std::string DatabaseUsername;
|
||||
@@ -122,12 +114,18 @@ class EQEmuConfig
|
||||
|
||||
bool auto_database_updates;
|
||||
|
||||
const std::string &GetUCSHost() const;
|
||||
uint16 GetUCSPort() const;
|
||||
|
||||
// uint16 DynamicCount;
|
||||
|
||||
// map<string,uint16> StaticZones;
|
||||
|
||||
protected:
|
||||
|
||||
std::string m_ucs_host;
|
||||
uint16 m_ucs_port;
|
||||
|
||||
static EQEmuConfig *_config;
|
||||
Json::Value _root;
|
||||
static std::string ConfigFile;
|
||||
@@ -186,6 +184,7 @@ class EQEmuConfig
|
||||
}
|
||||
|
||||
void Dump() const;
|
||||
void CheckUcsConfigConversion();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
+13
-7
@@ -651,6 +651,9 @@ EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings()
|
||||
}
|
||||
|
||||
// Auto inject categories that don't exist in the database...
|
||||
|
||||
std::vector<LogsysCategoriesRepository::LogsysCategories> db_categories_to_add{};
|
||||
|
||||
for (int i = Logs::AA; i != Logs::MaxCategoryID; i++) {
|
||||
|
||||
bool is_missing_in_database = std::find(db_categories.begin(), db_categories.end(), i) == db_categories.end();
|
||||
@@ -665,11 +668,7 @@ EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings()
|
||||
}
|
||||
|
||||
if (is_missing_in_database && !is_deprecated_category) {
|
||||
LogInfo(
|
||||
"Automatically adding new log category [{}] ({})",
|
||||
Logs::LogCategoryName[i],
|
||||
i
|
||||
);
|
||||
LogInfo("Automatically adding new log category [{}] ({})", Logs::LogCategoryName[i], i);
|
||||
|
||||
auto new_category = LogsysCategoriesRepository::NewEntity();
|
||||
new_category.log_category_id = i;
|
||||
@@ -678,11 +677,16 @@ EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings()
|
||||
new_category.log_to_gmsay = log_settings[i].log_to_gmsay;
|
||||
new_category.log_to_file = log_settings[i].log_to_file;
|
||||
new_category.log_to_discord = log_settings[i].log_to_discord;
|
||||
|
||||
LogsysCategoriesRepository::InsertOne(*m_database, new_category);
|
||||
db_categories_to_add.emplace_back(new_category);
|
||||
}
|
||||
}
|
||||
|
||||
if (!db_categories_to_add.empty()) {
|
||||
LogsysCategoriesRepository::ReplaceMany(*m_database, db_categories_to_add);
|
||||
LoadLogDatabaseSettings();
|
||||
return this;
|
||||
}
|
||||
|
||||
LogInfo("Loaded [{}] log categories", categories.size());
|
||||
|
||||
auto webhooks = DiscordWebhooksRepository::GetWhere(*m_database, fmt::format("id < {}", MAX_DISCORD_WEBHOOK_ID));
|
||||
@@ -697,6 +701,8 @@ EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings()
|
||||
log_settings[Logs::Crash].log_to_console = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::Crash].log_to_gmsay = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::Crash].log_to_file = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::Info].log_to_file = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::Info].log_to_console = static_cast<uint8>(Logs::General);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with this library; if not, write to the Free
|
||||
Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
|
||||
MA 02111-1307, USA */
|
||||
|
||||
/* Error messages for mysql clients */
|
||||
/* error messages for the demon is in share/language/errmsg.sys */
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
void init_client_errs(void);
|
||||
extern const char *client_errors[]; /* Error messages */
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#define CR_MIN_ERROR 2000 /* For easier client code */
|
||||
#define CR_MAX_ERROR 2999
|
||||
#if defined(OS2) && defined( MYSQL_SERVER)
|
||||
#define CER(X) client_errors[(X)-CR_MIN_ERROR]
|
||||
#else
|
||||
#define ER(X) client_errors[(X)-CR_MIN_ERROR]
|
||||
#endif
|
||||
#define CLIENT_ERRMAP 2 /* Errormap used by my_error() */
|
||||
|
||||
#define CR_UNKNOWN_ERROR 2000
|
||||
#define CR_SOCKET_CREATE_ERROR 2001
|
||||
#define CR_CONNECTION_ERROR 2002
|
||||
#define CR_CONN_HOST_ERROR 2003
|
||||
#define CR_IPSOCK_ERROR 2004
|
||||
#define CR_UNKNOWN_HOST 2005
|
||||
#define CR_SERVER_GONE_ERROR 2006
|
||||
#define CR_VERSION_ERROR 2007
|
||||
#define CR_OUT_OF_MEMORY 2008
|
||||
#define CR_WRONG_HOST_INFO 2009
|
||||
#define CR_LOCALHOST_CONNECTION 2010
|
||||
#define CR_TCP_CONNECTION 2011
|
||||
#define CR_SERVER_HANDSHAKE_ERR 2012
|
||||
#define CR_SERVER_LOST 2013
|
||||
#define CR_COMMANDS_OUT_OF_SYNC 2014
|
||||
#define CR_NAMEDPIPE_CONNECTION 2015
|
||||
#define CR_NAMEDPIPEWAIT_ERROR 2016
|
||||
#define CR_NAMEDPIPEOPEN_ERROR 2017
|
||||
#define CR_NAMEDPIPESETSTATE_ERROR 2018
|
||||
#define CR_CANT_READ_CHARSET 2019
|
||||
#define CR_NET_PACKET_TOO_LARGE 2020
|
||||
@@ -37,6 +37,8 @@ void PlayerEventLogs::Init()
|
||||
db.emplace_back(e.id);
|
||||
}
|
||||
|
||||
std::vector<PlayerEventLogSettingsRepository::PlayerEventLogSettings> settings_to_insert{};
|
||||
|
||||
// insert entries that don't exist in database
|
||||
for (int i = PlayerEvent::GM_COMMAND; i != PlayerEvent::MAX; i++) {
|
||||
bool is_in_database = std::find(db.begin(), db.end(), i) != db.end();
|
||||
@@ -56,21 +58,21 @@ void PlayerEventLogs::Init()
|
||||
|
||||
bool is_missing_in_database = std::find(db.begin(), db.end(), i) == db.end();
|
||||
if (is_missing_in_database && is_implemented && !is_deprecated) {
|
||||
LogInfo(
|
||||
"[New] PlayerEvent [{}] ({})",
|
||||
PlayerEvent::EventName[i],
|
||||
i
|
||||
);
|
||||
LogInfo("[New] PlayerEvent [{}] ({})", PlayerEvent::EventName[i], i);
|
||||
|
||||
auto c = PlayerEventLogSettingsRepository::NewEntity();
|
||||
c.id = i;
|
||||
c.event_name = PlayerEvent::EventName[i];
|
||||
c.event_enabled = m_settings[i].event_enabled;
|
||||
c.retention_days = m_settings[i].retention_days;
|
||||
PlayerEventLogSettingsRepository::InsertOne(*m_database, c);
|
||||
settings_to_insert.emplace_back(c);
|
||||
}
|
||||
}
|
||||
|
||||
if (!settings_to_insert.empty()) {
|
||||
PlayerEventLogSettingsRepository::ReplaceMany(*m_database, settings_to_insert);
|
||||
}
|
||||
|
||||
bool processing_in_world = !RuleB(Logging, PlayerEventsQSProcess) && IsWorld();
|
||||
bool processing_in_qs = RuleB(Logging, PlayerEventsQSProcess) && IsQueryServ();
|
||||
|
||||
@@ -611,7 +613,7 @@ void PlayerEventLogs::Process()
|
||||
|
||||
void PlayerEventLogs::ProcessRetentionTruncation()
|
||||
{
|
||||
LogInfo("Running truncation");
|
||||
LogPlayerEvents("Running truncation");
|
||||
|
||||
for (int i = PlayerEvent::GM_COMMAND; i != PlayerEvent::MAX; i++) {
|
||||
if (m_settings[i].retention_days > 0) {
|
||||
|
||||
+2
-2
@@ -96,12 +96,12 @@ bool IsOfEqualRace(int r1, int r2)
|
||||
// TODO: add more values
|
||||
switch (r1) {
|
||||
case DARK_ELF:
|
||||
if (r2 == RACE_NERIAK_CITIZEN_77) {
|
||||
if (r2 == Race::NeriakCitizen) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case BARBARIAN:
|
||||
if (r2 == RACE_HALAS_CITIZEN_90) {
|
||||
if (r2 == Race::HalasCitizen) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,11 +35,6 @@ Core Zone features
|
||||
|
||||
*/
|
||||
|
||||
|
||||
//Uncomment this to cause a zone to basically idle
|
||||
//when there are no players in it, mobs stop wandering, etc..
|
||||
#define IDLE_WHEN_EMPTY
|
||||
|
||||
#ifdef EMBPERL
|
||||
//Enable the new XS based perl parser
|
||||
#define EMBPERL_XS
|
||||
|
||||
@@ -801,34 +801,35 @@ int16 EQ::InventoryProfile::HasItemByLoreGroup(uint32 loregroup, uint8 where)
|
||||
// Returns slot_id when there's one available, else SLOT_INVALID
|
||||
int16 EQ::InventoryProfile::FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size, bool is_arrow)
|
||||
{
|
||||
// Check basic inventory
|
||||
for (int16 i = invslot::GENERAL_BEGIN; i <= invslot::GENERAL_END; i++) {
|
||||
if ((((uint64)1 << i) & m_lookup->PossessionsBitmask) == 0)
|
||||
continue;
|
||||
const int16 last_bag_slot = (RuleI(World, ExpansionSettings) == -1 || RuleI(World, ExpansionSettings) & EQ::expansions::bitHoT) ? EQ::invslot::slotGeneral10 : EQ::invslot::slotGeneral8;
|
||||
|
||||
if (!GetItem(i))
|
||||
// Found available slot in personal inventory
|
||||
return i;
|
||||
for (int16 i = invslot::GENERAL_BEGIN; i <= last_bag_slot; i++) { // Check basic inventory
|
||||
if ((((uint64) 1 << i) & m_lookup->PossessionsBitmask) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!GetItem(i)) {
|
||||
return i; // Found available slot in personal inventory
|
||||
}
|
||||
}
|
||||
|
||||
if (!for_bag) {
|
||||
for (int16 i = invslot::GENERAL_BEGIN; i <= invslot::GENERAL_END; i++) {
|
||||
if ((((uint64)1 << i) & m_lookup->PossessionsBitmask) == 0)
|
||||
for (int16 i = invslot::GENERAL_BEGIN; i <= last_bag_slot; i++) {
|
||||
if ((((uint64) 1 << i) & m_lookup->PossessionsBitmask) == 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const ItemInstance* inst = GetItem(i);
|
||||
if (inst && inst->IsClassBag() && inst->GetItem()->BagSize >= min_size)
|
||||
{
|
||||
if (inst->GetItem()->BagType == item::BagTypeQuiver && inst->GetItem()->ItemType != item::ItemTypeArrow)
|
||||
{
|
||||
const auto *inst = GetItem(i);
|
||||
if (inst && inst->IsClassBag() && inst->GetItem()->BagSize >= min_size) {
|
||||
if (inst->GetItem()->BagType == item::BagTypeQuiver &&
|
||||
inst->GetItem()->ItemType != item::ItemTypeArrow) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int16 base_slot_id = InventoryProfile::CalcSlotId(i, invbag::SLOT_BEGIN);
|
||||
const int16 base_slot_id = InventoryProfile::CalcSlotId(i, invbag::SLOT_BEGIN);
|
||||
|
||||
uint8 slots = inst->GetItem()->BagSlots;
|
||||
uint8 j;
|
||||
for (j = invbag::SLOT_BEGIN; j<slots; j++) {
|
||||
const uint8 slots = inst->GetItem()->BagSlots;
|
||||
for (uint8 j = invbag::SLOT_BEGIN; j < slots; j++) {
|
||||
if (!GetItem(base_slot_id + j)) {
|
||||
// Found available slot within bag
|
||||
return (base_slot_id + j);
|
||||
|
||||
@@ -132,7 +132,7 @@ namespace EQ
|
||||
|
||||
// Swap items in inventory
|
||||
enum SwapItemFailState : int8 { swapInvalid = -1, swapPass = 0, swapNotAllowed, swapNullData, swapRaceClass, swapDeity, swapLevel };
|
||||
bool SwapItem(int16 source_slot, int16 destination_slot, SwapItemFailState& fail_state, uint16 race_id = RACE_DOUG_0, uint8 class_id = Class::None, uint16 deity_id = deity::DeityType::DeityUnknown, uint8 level = 0);
|
||||
bool SwapItem(int16 source_slot, int16 destination_slot, SwapItemFailState& fail_state, uint16 race_id = Race::Doug, uint8 class_id = Class::None, uint16 deity_id = deity::DeityType::DeityUnknown, uint8 level = 0);
|
||||
|
||||
// Remove item from inventory
|
||||
bool DeleteItem(int16 slot_id, int16 quantity = 0);
|
||||
|
||||
@@ -1273,7 +1273,7 @@ int EQ::ItemInstance::GetItemBaneDamageBody(bool augments) const
|
||||
|
||||
int EQ::ItemInstance::GetItemBaneDamageRace(bool augments) const
|
||||
{
|
||||
int race = RACE_DOUG_0;
|
||||
int race = Race::Doug;
|
||||
const auto item = GetItem();
|
||||
if (item) {
|
||||
race = item->BaneDmgRace;
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
Copyright (C) 2001-2002 EQEMu Development Team (http://eqemulator.org)
|
||||
|
||||
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 LANGUAGES_H
|
||||
#define LANGUAGES_H
|
||||
#include "../common/types.h"
|
||||
|
||||
#define LANG_COMMON_TONGUE 0
|
||||
#define LANG_BARBARIAN 1
|
||||
#define LANG_ERUDIAN 2
|
||||
#define LANG_ELVISH 3
|
||||
#define LANG_DARK_ELVISH 4
|
||||
#define LANG_DWARVISH 5
|
||||
#define LANG_TROLL 6
|
||||
#define LANG_OGRE 7
|
||||
#define LANG_GNOMISH 8
|
||||
#define LANG_HALFLING 9
|
||||
#define LANG_THIEVES_CANT 10
|
||||
#define LANG_OLD_ERUDIAN 11
|
||||
#define LANG_ELDER_ELVISH 12
|
||||
#define LANG_FROGLOK 13
|
||||
#define LANG_GOBLIN 14
|
||||
#define LANG_GNOLL 15
|
||||
#define LANG_COMBINE_TONGUE 16
|
||||
#define LANG_ELDER_TEIRDAL 17
|
||||
#define LANG_LIZARDMAN 18
|
||||
#define LANG_ORCISH 19
|
||||
#define LANG_FAERIE 20
|
||||
#define LANG_DRAGON 21
|
||||
#define LANG_ELDER_DRAGON 22
|
||||
#define LANG_DARK_SPEECH 23
|
||||
#define LANG_VAH_SHIR 24
|
||||
#define LANG_ALARAN 25
|
||||
#define LANG_HADAL 26
|
||||
#define LANG_UNKNOWN 27
|
||||
|
||||
#define MAX_LANGUAGE_SKILL 100
|
||||
|
||||
#endif
|
||||
|
||||
@@ -202,7 +202,7 @@ namespace RoF
|
||||
unsigned char *emu_buffer = in->pBuffer;
|
||||
uint32 opcode = *((uint32*)emu_buffer);
|
||||
|
||||
if (opcode == 8) {
|
||||
if (opcode == AlternateCurrencyMode::Populate) {
|
||||
AltCurrencyPopulate_Struct *populate = (AltCurrencyPopulate_Struct*)emu_buffer;
|
||||
|
||||
auto outapp = new EQApplicationPacket(
|
||||
@@ -2621,7 +2621,7 @@ namespace RoF
|
||||
general->parameter = RaidCommandAcceptInvite;
|
||||
strn0cpy(general->leader_name, emu->leader_name, sizeof(emu->leader_name));
|
||||
strn0cpy(general->player_name, emu->leader_name, sizeof(emu->leader_name));
|
||||
|
||||
|
||||
dest->FastQueuePacket(&outapp);
|
||||
|
||||
safe_delete(inapp);
|
||||
@@ -3165,7 +3165,7 @@ namespace RoF
|
||||
|
||||
SpawnAppearance_Struct *sas = (SpawnAppearance_Struct *)emu_buffer;
|
||||
|
||||
if (sas->type != AT_Size)
|
||||
if (sas->type != AppearanceType::Size)
|
||||
{
|
||||
dest->FastQueuePacket(&in, ack_req);
|
||||
return;
|
||||
@@ -3868,8 +3868,8 @@ namespace RoF
|
||||
}
|
||||
|
||||
float SpawnSize = emu->size;
|
||||
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522))
|
||||
if (!((emu->NPC == 0) || (emu->race <= Race::Gnome) || (emu->race == Race::Iksar) ||
|
||||
(emu->race == Race::VahShir) || (emu->race == Race::Froglok2) || (emu->race == Race::Drakkin))
|
||||
)
|
||||
{
|
||||
PacketSize += 60;
|
||||
@@ -4002,8 +4002,8 @@ namespace RoF
|
||||
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // unknown18
|
||||
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // unknown19
|
||||
|
||||
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)
|
||||
if ((emu->NPC == 0) || (emu->race <= Race::Gnome) || (emu->race == Race::Iksar) ||
|
||||
(emu->race == Race::VahShir) || (emu->race == Race::Froglok2) || (emu->race == Race::Drakkin)
|
||||
)
|
||||
{
|
||||
for (k = EQ::textures::textureBegin; k < EQ::textures::materialCount; ++k)
|
||||
|
||||
@@ -274,7 +274,7 @@ namespace RoF2
|
||||
unsigned char *emu_buffer = in->pBuffer;
|
||||
uint32 opcode = *((uint32*)emu_buffer);
|
||||
|
||||
if (opcode == 8) {
|
||||
if (opcode == AlternateCurrencyMode::Populate) {
|
||||
AltCurrencyPopulate_Struct *populate = (AltCurrencyPopulate_Struct*)emu_buffer;
|
||||
|
||||
auto outapp = new EQApplicationPacket(
|
||||
@@ -3218,7 +3218,7 @@ namespace RoF2
|
||||
|
||||
SpawnAppearance_Struct *sas = (SpawnAppearance_Struct *)emu_buffer;
|
||||
|
||||
if (sas->type != AT_Size)
|
||||
if (sas->type != AppearanceType::Size)
|
||||
{
|
||||
dest->FastQueuePacket(&in, ack_req);
|
||||
return;
|
||||
@@ -4007,8 +4007,8 @@ namespace RoF2
|
||||
}
|
||||
|
||||
float SpawnSize = emu->size;
|
||||
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522))
|
||||
if (!((emu->NPC == 0) || (emu->race <= Race::Gnome) || (emu->race == Race::Iksar) ||
|
||||
(emu->race == Race::VahShir) || (emu->race == Race::Froglok2) || (emu->race == Race::Drakkin))
|
||||
)
|
||||
{
|
||||
PacketSize += 60;
|
||||
@@ -4212,8 +4212,8 @@ namespace RoF2
|
||||
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // These do something with OP_WeaponEquip1
|
||||
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // ^
|
||||
|
||||
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)
|
||||
if ((emu->NPC == 0) || (emu->race <= Race::Gnome) || (emu->race == Race::Iksar) ||
|
||||
(emu->race == Race::VahShir) || (emu->race == Race::Froglok2) || (emu->race == Race::Drakkin)
|
||||
)
|
||||
{
|
||||
for (k = EQ::textures::textureBegin; k < EQ::textures::materialCount; ++k)
|
||||
|
||||
@@ -3619,7 +3619,7 @@ struct Make_Pet_Struct { //Simple struct for getting pet info
|
||||
uint32 min_dmg;
|
||||
uint32 max_dmg;
|
||||
};
|
||||
struct Ground_Spawn{
|
||||
struct GroundSpawn{
|
||||
float max_x;
|
||||
float max_y;
|
||||
float min_x;
|
||||
@@ -3631,8 +3631,8 @@ struct Ground_Spawn{
|
||||
uint32 max_allowed;
|
||||
uint32 respawntimer;
|
||||
};
|
||||
struct Ground_Spawns {
|
||||
struct Ground_Spawn spawn[50]; //Assigned max number to allow
|
||||
struct GroundSpawns {
|
||||
struct GroundSpawn spawn[50]; //Assigned max number to allow
|
||||
};
|
||||
|
||||
//struct PetitionBug_Struct{
|
||||
|
||||
@@ -3556,7 +3556,7 @@ struct Make_Pet_Struct { //Simple struct for getting pet info
|
||||
uint32 min_dmg;
|
||||
uint32 max_dmg;
|
||||
};
|
||||
struct Ground_Spawn{
|
||||
struct GroundSpawn{
|
||||
float max_x;
|
||||
float max_y;
|
||||
float min_x;
|
||||
@@ -3568,8 +3568,8 @@ struct Ground_Spawn{
|
||||
uint32 max_allowed;
|
||||
uint32 respawntimer;
|
||||
};
|
||||
struct Ground_Spawns {
|
||||
struct Ground_Spawn spawn[50]; //Assigned max number to allow
|
||||
struct GroundSpawns {
|
||||
struct GroundSpawn spawn[50]; //Assigned max number to allow
|
||||
};
|
||||
|
||||
//struct PetitionBug_Struct{
|
||||
|
||||
@@ -2507,8 +2507,8 @@ namespace SoD
|
||||
}
|
||||
|
||||
float SpawnSize = emu->size;
|
||||
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522))
|
||||
if (!((emu->NPC == 0) || (emu->race <= Race::Gnome) || (emu->race == Race::Iksar) ||
|
||||
(emu->race == Race::VahShir) || (emu->race == Race::Froglok2) || (emu->race == Race::Drakkin))
|
||||
)
|
||||
{
|
||||
PacketSize -= (sizeof(structs::Texture_Struct) * EQ::textures::materialCount);
|
||||
@@ -2706,8 +2706,8 @@ namespace SoD
|
||||
|
||||
Buffer += sizeof(structs::Spawn_Struct_Position);
|
||||
|
||||
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)
|
||||
if ((emu->NPC == 0) || (emu->race <= Race::Gnome) || (emu->race == Race::Iksar) ||
|
||||
(emu->race == Race::VahShir) || (emu->race == Race::Froglok2) || (emu->race == Race::Drakkin)
|
||||
)
|
||||
{
|
||||
for (k = EQ::textures::textureBegin; k < EQ::textures::materialCount; ++k)
|
||||
@@ -2733,8 +2733,8 @@ namespace SoD
|
||||
}
|
||||
|
||||
|
||||
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)
|
||||
if ((emu->NPC == 0) || (emu->race <= Race::Gnome) || (emu->race == Race::Iksar) ||
|
||||
(emu->race == Race::VahShir) || (emu->race == Race::Froglok2) || (emu->race == Race::Drakkin)
|
||||
)
|
||||
{
|
||||
structs::Texture_Struct *Equipment = (structs::Texture_Struct *)Buffer;
|
||||
|
||||
@@ -3026,7 +3026,7 @@ struct Make_Pet_Struct { //Simple struct for getting pet info
|
||||
uint32 min_dmg;
|
||||
uint32 max_dmg;
|
||||
};
|
||||
struct Ground_Spawn{
|
||||
struct GroundSpawn{
|
||||
float max_x;
|
||||
float max_y;
|
||||
float min_x;
|
||||
@@ -3038,8 +3038,8 @@ struct Ground_Spawn{
|
||||
uint32 max_allowed;
|
||||
uint32 respawntimer;
|
||||
};
|
||||
struct Ground_Spawns {
|
||||
struct Ground_Spawn spawn[50]; //Assigned max number to allow
|
||||
struct GroundSpawns {
|
||||
struct GroundSpawn spawn[50]; //Assigned max number to allow
|
||||
};
|
||||
|
||||
//struct PetitionBug_Struct{
|
||||
|
||||
@@ -2951,7 +2951,7 @@ struct Make_Pet_Struct { //Simple struct for getting pet info
|
||||
uint32 min_dmg;
|
||||
uint32 max_dmg;
|
||||
};
|
||||
struct Ground_Spawn{
|
||||
struct GroundSpawn{
|
||||
float max_x;
|
||||
float max_y;
|
||||
float min_x;
|
||||
@@ -2963,8 +2963,8 @@ struct Ground_Spawn{
|
||||
uint32 max_allowed;
|
||||
uint32 respawntimer;
|
||||
};
|
||||
struct Ground_Spawns {
|
||||
struct Ground_Spawn spawn[50]; //Assigned max number to allow
|
||||
struct GroundSpawns {
|
||||
struct GroundSpawn spawn[50]; //Assigned max number to allow
|
||||
};
|
||||
|
||||
//struct PetitionBug_Struct{
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* EQEMu: Everquest Server Emulator
|
||||
|
||||
|
||||
Copyright (C) 2001-2016 EQEMu Development Team (http://eqemulator.net)
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
@@ -2604,7 +2604,7 @@ struct Make_Pet_Struct { //Simple struct for getting pet info
|
||||
uint32 min_dmg;
|
||||
uint32 max_dmg;
|
||||
};
|
||||
struct Ground_Spawn{
|
||||
struct GroundSpawn{
|
||||
float max_x;
|
||||
float max_y;
|
||||
float min_x;
|
||||
@@ -2616,8 +2616,8 @@ struct Ground_Spawn{
|
||||
uint32 max_allowed;
|
||||
uint32 respawntimer;
|
||||
};
|
||||
struct Ground_Spawns {
|
||||
struct Ground_Spawn spawn[50]; //Assigned max number to allow
|
||||
struct GroundSpawns {
|
||||
struct GroundSpawn spawn[50]; //Assigned max number to allow
|
||||
};
|
||||
|
||||
//struct PetitionBug_Struct{
|
||||
|
||||
@@ -195,7 +195,7 @@ namespace UF
|
||||
unsigned char *emu_buffer = in->pBuffer;
|
||||
uint32 opcode = *((uint32*)emu_buffer);
|
||||
|
||||
if (opcode == 8) {
|
||||
if (opcode == AlternateCurrencyMode::Populate) {
|
||||
AltCurrencyPopulate_Struct *populate = (AltCurrencyPopulate_Struct*)emu_buffer;
|
||||
|
||||
auto outapp = new EQApplicationPacket(
|
||||
@@ -2339,7 +2339,7 @@ namespace UF
|
||||
|
||||
SpawnAppearance_Struct *sas = (SpawnAppearance_Struct *)emu_buffer;
|
||||
|
||||
if (sas->type != AT_Size)
|
||||
if (sas->type != AppearanceType::Size)
|
||||
{
|
||||
dest->FastQueuePacket(&in, ack_req);
|
||||
return;
|
||||
@@ -2779,8 +2779,8 @@ namespace UF
|
||||
}
|
||||
|
||||
float SpawnSize = emu->size;
|
||||
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522))
|
||||
if (!((emu->NPC == 0) || (emu->race <= Race::Gnome) || (emu->race == Race::Iksar) ||
|
||||
(emu->race == Race::VahShir) || (emu->race == Race::Froglok2) || (emu->race == Race::Drakkin))
|
||||
)
|
||||
{
|
||||
PacketSize -= (sizeof(structs::Texture_Struct) * EQ::textures::materialCount);
|
||||
@@ -2982,8 +2982,8 @@ namespace UF
|
||||
|
||||
Buffer += sizeof(structs::Spawn_Struct_Position);
|
||||
|
||||
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)
|
||||
if ((emu->NPC == 0) || (emu->race <= Race::Gnome) || (emu->race == Race::Iksar) ||
|
||||
(emu->race == Race::VahShir) || (emu->race == Race::Froglok2) || (emu->race == Race::Drakkin)
|
||||
)
|
||||
{
|
||||
for (k = EQ::textures::textureBegin; k < EQ::textures::materialCount; ++k)
|
||||
@@ -3018,8 +3018,8 @@ namespace UF
|
||||
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
|
||||
}
|
||||
|
||||
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)
|
||||
if ((emu->NPC == 0) || (emu->race <= Race::Gnome) || (emu->race == Race::Iksar) ||
|
||||
(emu->race == Race::VahShir) || (emu->race == Race::Froglok2) || (emu->race == Race::Drakkin)
|
||||
)
|
||||
{
|
||||
structs::Texture_Struct *Equipment = (structs::Texture_Struct *)Buffer;
|
||||
|
||||
@@ -3078,7 +3078,7 @@ struct Make_Pet_Struct { //Simple struct for getting pet info
|
||||
uint32 min_dmg;
|
||||
uint32 max_dmg;
|
||||
};
|
||||
struct Ground_Spawn{
|
||||
struct GroundSpawn{
|
||||
float max_x;
|
||||
float max_y;
|
||||
float min_x;
|
||||
@@ -3090,8 +3090,8 @@ struct Ground_Spawn{
|
||||
uint32 max_allowed;
|
||||
uint32 respawntimer;
|
||||
};
|
||||
struct Ground_Spawns {
|
||||
struct Ground_Spawn spawn[50]; //Assigned max number to allow
|
||||
struct GroundSpawns {
|
||||
struct GroundSpawn spawn[50]; //Assigned max number to allow
|
||||
};
|
||||
|
||||
//struct PetitionBug_Struct{
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
// types
|
||||
#include <limits>
|
||||
#include <string>
|
||||
#include <cctype>
|
||||
#include <sstream>
|
||||
|
||||
// containers
|
||||
#include <iterator>
|
||||
#include <set>
|
||||
#include <unordered_set>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
|
||||
// utilities
|
||||
#include <iostream>
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
#include <utility>
|
||||
#include <tuple>
|
||||
#include <fstream>
|
||||
#include <cstdio>
|
||||
|
||||
// fmt
|
||||
#include <fmt/format.h>
|
||||
|
||||
// lua
|
||||
#include "lua.hpp"
|
||||
#include <luabind/luabind.hpp>
|
||||
#include <luabind/object.hpp>
|
||||
+3
-2
@@ -44,9 +44,10 @@ enum : int { //values for pTimerType
|
||||
pTimerBeggingPickPocket = 27,
|
||||
pTimerLinkedSpellReuseStart = 28,
|
||||
pTimerLinkedSpellReuseEnd = 48,
|
||||
pTimerClearXTarget = 50,
|
||||
|
||||
pTimerShieldAbility = 86,
|
||||
|
||||
pTimerShieldAbility = 86,
|
||||
|
||||
pTimerLayHands = 87, //these IDs are used by client too
|
||||
pTimerHarmTouch = 89, //so dont change them
|
||||
|
||||
|
||||
+791
-791
File diff suppressed because it is too large
Load Diff
+744
-1474
File diff suppressed because it is too large
Load Diff
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_AA_ABILITY_REPOSITORY_H
|
||||
@@ -33,6 +33,7 @@ public:
|
||||
int32_t first_rank_id;
|
||||
uint8_t enabled;
|
||||
int8_t reset_on_death;
|
||||
int8_t auto_grant_enabled;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
@@ -57,6 +58,7 @@ public:
|
||||
"first_rank_id",
|
||||
"enabled",
|
||||
"reset_on_death",
|
||||
"auto_grant_enabled",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -77,6 +79,7 @@ public:
|
||||
"first_rank_id",
|
||||
"enabled",
|
||||
"reset_on_death",
|
||||
"auto_grant_enabled",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -117,20 +120,21 @@ public:
|
||||
{
|
||||
AaAbility e{};
|
||||
|
||||
e.id = 0;
|
||||
e.name = "";
|
||||
e.category = -1;
|
||||
e.classes = 131070;
|
||||
e.races = 65535;
|
||||
e.drakkin_heritage = 127;
|
||||
e.deities = 131071;
|
||||
e.status = 0;
|
||||
e.type = 0;
|
||||
e.charges = 0;
|
||||
e.grant_only = 0;
|
||||
e.first_rank_id = -1;
|
||||
e.enabled = 1;
|
||||
e.reset_on_death = 0;
|
||||
e.id = 0;
|
||||
e.name = "";
|
||||
e.category = -1;
|
||||
e.classes = 131070;
|
||||
e.races = 65535;
|
||||
e.drakkin_heritage = 127;
|
||||
e.deities = 131071;
|
||||
e.status = 0;
|
||||
e.type = 0;
|
||||
e.charges = 0;
|
||||
e.grant_only = 0;
|
||||
e.first_rank_id = -1;
|
||||
e.enabled = 1;
|
||||
e.reset_on_death = 0;
|
||||
e.auto_grant_enabled = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -156,8 +160,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
aa_ability_id
|
||||
)
|
||||
);
|
||||
@@ -166,20 +171,21 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
AaAbility e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.category = static_cast<int32_t>(atoi(row[2]));
|
||||
e.classes = static_cast<int32_t>(atoi(row[3]));
|
||||
e.races = static_cast<int32_t>(atoi(row[4]));
|
||||
e.drakkin_heritage = static_cast<int32_t>(atoi(row[5]));
|
||||
e.deities = static_cast<int32_t>(atoi(row[6]));
|
||||
e.status = static_cast<int32_t>(atoi(row[7]));
|
||||
e.type = static_cast<int32_t>(atoi(row[8]));
|
||||
e.charges = static_cast<int32_t>(atoi(row[9]));
|
||||
e.grant_only = static_cast<int8_t>(atoi(row[10]));
|
||||
e.first_rank_id = static_cast<int32_t>(atoi(row[11]));
|
||||
e.enabled = static_cast<uint8_t>(strtoul(row[12], nullptr, 10));
|
||||
e.reset_on_death = static_cast<int8_t>(atoi(row[13]));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.category = row[2] ? static_cast<int32_t>(atoi(row[2])) : -1;
|
||||
e.classes = row[3] ? static_cast<int32_t>(atoi(row[3])) : 131070;
|
||||
e.races = row[4] ? static_cast<int32_t>(atoi(row[4])) : 65535;
|
||||
e.drakkin_heritage = row[5] ? static_cast<int32_t>(atoi(row[5])) : 127;
|
||||
e.deities = row[6] ? static_cast<int32_t>(atoi(row[6])) : 131071;
|
||||
e.status = row[7] ? static_cast<int32_t>(atoi(row[7])) : 0;
|
||||
e.type = row[8] ? static_cast<int32_t>(atoi(row[8])) : 0;
|
||||
e.charges = row[9] ? static_cast<int32_t>(atoi(row[9])) : 0;
|
||||
e.grant_only = row[10] ? static_cast<int8_t>(atoi(row[10])) : 0;
|
||||
e.first_rank_id = row[11] ? static_cast<int32_t>(atoi(row[11])) : -1;
|
||||
e.enabled = row[12] ? static_cast<uint8_t>(strtoul(row[12], nullptr, 10)) : 1;
|
||||
e.reset_on_death = row[13] ? static_cast<int8_t>(atoi(row[13])) : 0;
|
||||
e.auto_grant_enabled = row[14] ? static_cast<int8_t>(atoi(row[14])) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -227,6 +233,7 @@ public:
|
||||
v.push_back(columns[11] + " = " + std::to_string(e.first_rank_id));
|
||||
v.push_back(columns[12] + " = " + std::to_string(e.enabled));
|
||||
v.push_back(columns[13] + " = " + std::to_string(e.reset_on_death));
|
||||
v.push_back(columns[14] + " = " + std::to_string(e.auto_grant_enabled));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -262,6 +269,7 @@ public:
|
||||
v.push_back(std::to_string(e.first_rank_id));
|
||||
v.push_back(std::to_string(e.enabled));
|
||||
v.push_back(std::to_string(e.reset_on_death));
|
||||
v.push_back(std::to_string(e.auto_grant_enabled));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -305,6 +313,7 @@ public:
|
||||
v.push_back(std::to_string(e.first_rank_id));
|
||||
v.push_back(std::to_string(e.enabled));
|
||||
v.push_back(std::to_string(e.reset_on_death));
|
||||
v.push_back(std::to_string(e.auto_grant_enabled));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
@@ -338,20 +347,21 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AaAbility e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.category = static_cast<int32_t>(atoi(row[2]));
|
||||
e.classes = static_cast<int32_t>(atoi(row[3]));
|
||||
e.races = static_cast<int32_t>(atoi(row[4]));
|
||||
e.drakkin_heritage = static_cast<int32_t>(atoi(row[5]));
|
||||
e.deities = static_cast<int32_t>(atoi(row[6]));
|
||||
e.status = static_cast<int32_t>(atoi(row[7]));
|
||||
e.type = static_cast<int32_t>(atoi(row[8]));
|
||||
e.charges = static_cast<int32_t>(atoi(row[9]));
|
||||
e.grant_only = static_cast<int8_t>(atoi(row[10]));
|
||||
e.first_rank_id = static_cast<int32_t>(atoi(row[11]));
|
||||
e.enabled = static_cast<uint8_t>(strtoul(row[12], nullptr, 10));
|
||||
e.reset_on_death = static_cast<int8_t>(atoi(row[13]));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.category = row[2] ? static_cast<int32_t>(atoi(row[2])) : -1;
|
||||
e.classes = row[3] ? static_cast<int32_t>(atoi(row[3])) : 131070;
|
||||
e.races = row[4] ? static_cast<int32_t>(atoi(row[4])) : 65535;
|
||||
e.drakkin_heritage = row[5] ? static_cast<int32_t>(atoi(row[5])) : 127;
|
||||
e.deities = row[6] ? static_cast<int32_t>(atoi(row[6])) : 131071;
|
||||
e.status = row[7] ? static_cast<int32_t>(atoi(row[7])) : 0;
|
||||
e.type = row[8] ? static_cast<int32_t>(atoi(row[8])) : 0;
|
||||
e.charges = row[9] ? static_cast<int32_t>(atoi(row[9])) : 0;
|
||||
e.grant_only = row[10] ? static_cast<int8_t>(atoi(row[10])) : 0;
|
||||
e.first_rank_id = row[11] ? static_cast<int32_t>(atoi(row[11])) : -1;
|
||||
e.enabled = row[12] ? static_cast<uint8_t>(strtoul(row[12], nullptr, 10)) : 1;
|
||||
e.reset_on_death = row[13] ? static_cast<int8_t>(atoi(row[13])) : 0;
|
||||
e.auto_grant_enabled = row[14] ? static_cast<int8_t>(atoi(row[14])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -376,20 +386,21 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AaAbility e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.category = static_cast<int32_t>(atoi(row[2]));
|
||||
e.classes = static_cast<int32_t>(atoi(row[3]));
|
||||
e.races = static_cast<int32_t>(atoi(row[4]));
|
||||
e.drakkin_heritage = static_cast<int32_t>(atoi(row[5]));
|
||||
e.deities = static_cast<int32_t>(atoi(row[6]));
|
||||
e.status = static_cast<int32_t>(atoi(row[7]));
|
||||
e.type = static_cast<int32_t>(atoi(row[8]));
|
||||
e.charges = static_cast<int32_t>(atoi(row[9]));
|
||||
e.grant_only = static_cast<int8_t>(atoi(row[10]));
|
||||
e.first_rank_id = static_cast<int32_t>(atoi(row[11]));
|
||||
e.enabled = static_cast<uint8_t>(strtoul(row[12], nullptr, 10));
|
||||
e.reset_on_death = static_cast<int8_t>(atoi(row[13]));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.category = row[2] ? static_cast<int32_t>(atoi(row[2])) : -1;
|
||||
e.classes = row[3] ? static_cast<int32_t>(atoi(row[3])) : 131070;
|
||||
e.races = row[4] ? static_cast<int32_t>(atoi(row[4])) : 65535;
|
||||
e.drakkin_heritage = row[5] ? static_cast<int32_t>(atoi(row[5])) : 127;
|
||||
e.deities = row[6] ? static_cast<int32_t>(atoi(row[6])) : 131071;
|
||||
e.status = row[7] ? static_cast<int32_t>(atoi(row[7])) : 0;
|
||||
e.type = row[8] ? static_cast<int32_t>(atoi(row[8])) : 0;
|
||||
e.charges = row[9] ? static_cast<int32_t>(atoi(row[9])) : 0;
|
||||
e.grant_only = row[10] ? static_cast<int8_t>(atoi(row[10])) : 0;
|
||||
e.first_rank_id = row[11] ? static_cast<int32_t>(atoi(row[11])) : -1;
|
||||
e.enabled = row[12] ? static_cast<uint8_t>(strtoul(row[12], nullptr, 10)) : 1;
|
||||
e.reset_on_death = row[13] ? static_cast<int8_t>(atoi(row[13])) : 0;
|
||||
e.auto_grant_enabled = row[14] ? static_cast<int8_t>(atoi(row[14])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -448,6 +459,90 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const AaAbility &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
v.push_back(std::to_string(e.category));
|
||||
v.push_back(std::to_string(e.classes));
|
||||
v.push_back(std::to_string(e.races));
|
||||
v.push_back(std::to_string(e.drakkin_heritage));
|
||||
v.push_back(std::to_string(e.deities));
|
||||
v.push_back(std::to_string(e.status));
|
||||
v.push_back(std::to_string(e.type));
|
||||
v.push_back(std::to_string(e.charges));
|
||||
v.push_back(std::to_string(e.grant_only));
|
||||
v.push_back(std::to_string(e.first_rank_id));
|
||||
v.push_back(std::to_string(e.enabled));
|
||||
v.push_back(std::to_string(e.reset_on_death));
|
||||
v.push_back(std::to_string(e.auto_grant_enabled));
|
||||
|
||||
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<AaAbility> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
v.push_back(std::to_string(e.category));
|
||||
v.push_back(std::to_string(e.classes));
|
||||
v.push_back(std::to_string(e.races));
|
||||
v.push_back(std::to_string(e.drakkin_heritage));
|
||||
v.push_back(std::to_string(e.deities));
|
||||
v.push_back(std::to_string(e.status));
|
||||
v.push_back(std::to_string(e.type));
|
||||
v.push_back(std::to_string(e.charges));
|
||||
v.push_back(std::to_string(e.grant_only));
|
||||
v.push_back(std::to_string(e.first_rank_id));
|
||||
v.push_back(std::to_string(e.enabled));
|
||||
v.push_back(std::to_string(e.reset_on_death));
|
||||
v.push_back(std::to_string(e.auto_grant_enabled));
|
||||
|
||||
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_AA_ABILITY_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_AA_RANK_EFFECTS_REPOSITORY_H
|
||||
@@ -120,8 +120,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
aa_rank_effects_id
|
||||
)
|
||||
);
|
||||
@@ -130,11 +131,11 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
AaRankEffects e{};
|
||||
|
||||
e.rank_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.slot = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.effect_id = static_cast<int32_t>(atoi(row[2]));
|
||||
e.base1 = static_cast<int32_t>(atoi(row[3]));
|
||||
e.base2 = static_cast<int32_t>(atoi(row[4]));
|
||||
e.rank_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.slot = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 1;
|
||||
e.effect_id = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
e.base1 = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
e.base2 = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -266,11 +267,11 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AaRankEffects e{};
|
||||
|
||||
e.rank_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.slot = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.effect_id = static_cast<int32_t>(atoi(row[2]));
|
||||
e.base1 = static_cast<int32_t>(atoi(row[3]));
|
||||
e.base2 = static_cast<int32_t>(atoi(row[4]));
|
||||
e.rank_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.slot = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 1;
|
||||
e.effect_id = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
e.base1 = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
e.base2 = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -295,11 +296,11 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AaRankEffects e{};
|
||||
|
||||
e.rank_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.slot = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.effect_id = static_cast<int32_t>(atoi(row[2]));
|
||||
e.base1 = static_cast<int32_t>(atoi(row[3]));
|
||||
e.base2 = static_cast<int32_t>(atoi(row[4]));
|
||||
e.rank_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.slot = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 1;
|
||||
e.effect_id = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
e.base1 = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
e.base2 = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -358,6 +359,70 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const AaRankEffects &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.rank_id));
|
||||
v.push_back(std::to_string(e.slot));
|
||||
v.push_back(std::to_string(e.effect_id));
|
||||
v.push_back(std::to_string(e.base1));
|
||||
v.push_back(std::to_string(e.base2));
|
||||
|
||||
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<AaRankEffects> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.rank_id));
|
||||
v.push_back(std::to_string(e.slot));
|
||||
v.push_back(std::to_string(e.effect_id));
|
||||
v.push_back(std::to_string(e.base1));
|
||||
v.push_back(std::to_string(e.base2));
|
||||
|
||||
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_AA_RANK_EFFECTS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_AA_RANK_PREREQS_REPOSITORY_H
|
||||
@@ -112,8 +112,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
aa_rank_prereqs_id
|
||||
)
|
||||
);
|
||||
@@ -122,9 +123,9 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
AaRankPrereqs e{};
|
||||
|
||||
e.rank_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.aa_id = static_cast<int32_t>(atoi(row[1]));
|
||||
e.points = static_cast<int32_t>(atoi(row[2]));
|
||||
e.rank_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.aa_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.points = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -250,9 +251,9 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AaRankPrereqs e{};
|
||||
|
||||
e.rank_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.aa_id = static_cast<int32_t>(atoi(row[1]));
|
||||
e.points = static_cast<int32_t>(atoi(row[2]));
|
||||
e.rank_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.aa_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.points = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -277,9 +278,9 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AaRankPrereqs e{};
|
||||
|
||||
e.rank_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.aa_id = static_cast<int32_t>(atoi(row[1]));
|
||||
e.points = static_cast<int32_t>(atoi(row[2]));
|
||||
e.rank_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.aa_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.points = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -338,6 +339,66 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const AaRankPrereqs &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.rank_id));
|
||||
v.push_back(std::to_string(e.aa_id));
|
||||
v.push_back(std::to_string(e.points));
|
||||
|
||||
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<AaRankPrereqs> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.rank_id));
|
||||
v.push_back(std::to_string(e.aa_id));
|
||||
v.push_back(std::to_string(e.points));
|
||||
|
||||
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_AA_RANK_PREREQS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_AA_RANKS_REPOSITORY_H
|
||||
@@ -152,8 +152,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
aa_ranks_id
|
||||
)
|
||||
);
|
||||
@@ -162,19 +163,19 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
AaRanks e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.upper_hotkey_sid = static_cast<int32_t>(atoi(row[1]));
|
||||
e.lower_hotkey_sid = static_cast<int32_t>(atoi(row[2]));
|
||||
e.title_sid = static_cast<int32_t>(atoi(row[3]));
|
||||
e.desc_sid = static_cast<int32_t>(atoi(row[4]));
|
||||
e.cost = static_cast<int32_t>(atoi(row[5]));
|
||||
e.level_req = static_cast<int32_t>(atoi(row[6]));
|
||||
e.spell = static_cast<int32_t>(atoi(row[7]));
|
||||
e.spell_type = static_cast<int32_t>(atoi(row[8]));
|
||||
e.recast_time = static_cast<int32_t>(atoi(row[9]));
|
||||
e.expansion = static_cast<int32_t>(atoi(row[10]));
|
||||
e.prev_id = static_cast<int32_t>(atoi(row[11]));
|
||||
e.next_id = static_cast<int32_t>(atoi(row[12]));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.upper_hotkey_sid = row[1] ? static_cast<int32_t>(atoi(row[1])) : -1;
|
||||
e.lower_hotkey_sid = row[2] ? static_cast<int32_t>(atoi(row[2])) : -1;
|
||||
e.title_sid = row[3] ? static_cast<int32_t>(atoi(row[3])) : -1;
|
||||
e.desc_sid = row[4] ? static_cast<int32_t>(atoi(row[4])) : -1;
|
||||
e.cost = row[5] ? static_cast<int32_t>(atoi(row[5])) : 1;
|
||||
e.level_req = row[6] ? static_cast<int32_t>(atoi(row[6])) : 51;
|
||||
e.spell = row[7] ? static_cast<int32_t>(atoi(row[7])) : -1;
|
||||
e.spell_type = row[8] ? static_cast<int32_t>(atoi(row[8])) : 0;
|
||||
e.recast_time = row[9] ? static_cast<int32_t>(atoi(row[9])) : 0;
|
||||
e.expansion = row[10] ? static_cast<int32_t>(atoi(row[10])) : 0;
|
||||
e.prev_id = row[11] ? static_cast<int32_t>(atoi(row[11])) : -1;
|
||||
e.next_id = row[12] ? static_cast<int32_t>(atoi(row[12])) : -1;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -330,19 +331,19 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AaRanks e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.upper_hotkey_sid = static_cast<int32_t>(atoi(row[1]));
|
||||
e.lower_hotkey_sid = static_cast<int32_t>(atoi(row[2]));
|
||||
e.title_sid = static_cast<int32_t>(atoi(row[3]));
|
||||
e.desc_sid = static_cast<int32_t>(atoi(row[4]));
|
||||
e.cost = static_cast<int32_t>(atoi(row[5]));
|
||||
e.level_req = static_cast<int32_t>(atoi(row[6]));
|
||||
e.spell = static_cast<int32_t>(atoi(row[7]));
|
||||
e.spell_type = static_cast<int32_t>(atoi(row[8]));
|
||||
e.recast_time = static_cast<int32_t>(atoi(row[9]));
|
||||
e.expansion = static_cast<int32_t>(atoi(row[10]));
|
||||
e.prev_id = static_cast<int32_t>(atoi(row[11]));
|
||||
e.next_id = static_cast<int32_t>(atoi(row[12]));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.upper_hotkey_sid = row[1] ? static_cast<int32_t>(atoi(row[1])) : -1;
|
||||
e.lower_hotkey_sid = row[2] ? static_cast<int32_t>(atoi(row[2])) : -1;
|
||||
e.title_sid = row[3] ? static_cast<int32_t>(atoi(row[3])) : -1;
|
||||
e.desc_sid = row[4] ? static_cast<int32_t>(atoi(row[4])) : -1;
|
||||
e.cost = row[5] ? static_cast<int32_t>(atoi(row[5])) : 1;
|
||||
e.level_req = row[6] ? static_cast<int32_t>(atoi(row[6])) : 51;
|
||||
e.spell = row[7] ? static_cast<int32_t>(atoi(row[7])) : -1;
|
||||
e.spell_type = row[8] ? static_cast<int32_t>(atoi(row[8])) : 0;
|
||||
e.recast_time = row[9] ? static_cast<int32_t>(atoi(row[9])) : 0;
|
||||
e.expansion = row[10] ? static_cast<int32_t>(atoi(row[10])) : 0;
|
||||
e.prev_id = row[11] ? static_cast<int32_t>(atoi(row[11])) : -1;
|
||||
e.next_id = row[12] ? static_cast<int32_t>(atoi(row[12])) : -1;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -367,19 +368,19 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AaRanks e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.upper_hotkey_sid = static_cast<int32_t>(atoi(row[1]));
|
||||
e.lower_hotkey_sid = static_cast<int32_t>(atoi(row[2]));
|
||||
e.title_sid = static_cast<int32_t>(atoi(row[3]));
|
||||
e.desc_sid = static_cast<int32_t>(atoi(row[4]));
|
||||
e.cost = static_cast<int32_t>(atoi(row[5]));
|
||||
e.level_req = static_cast<int32_t>(atoi(row[6]));
|
||||
e.spell = static_cast<int32_t>(atoi(row[7]));
|
||||
e.spell_type = static_cast<int32_t>(atoi(row[8]));
|
||||
e.recast_time = static_cast<int32_t>(atoi(row[9]));
|
||||
e.expansion = static_cast<int32_t>(atoi(row[10]));
|
||||
e.prev_id = static_cast<int32_t>(atoi(row[11]));
|
||||
e.next_id = static_cast<int32_t>(atoi(row[12]));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.upper_hotkey_sid = row[1] ? static_cast<int32_t>(atoi(row[1])) : -1;
|
||||
e.lower_hotkey_sid = row[2] ? static_cast<int32_t>(atoi(row[2])) : -1;
|
||||
e.title_sid = row[3] ? static_cast<int32_t>(atoi(row[3])) : -1;
|
||||
e.desc_sid = row[4] ? static_cast<int32_t>(atoi(row[4])) : -1;
|
||||
e.cost = row[5] ? static_cast<int32_t>(atoi(row[5])) : 1;
|
||||
e.level_req = row[6] ? static_cast<int32_t>(atoi(row[6])) : 51;
|
||||
e.spell = row[7] ? static_cast<int32_t>(atoi(row[7])) : -1;
|
||||
e.spell_type = row[8] ? static_cast<int32_t>(atoi(row[8])) : 0;
|
||||
e.recast_time = row[9] ? static_cast<int32_t>(atoi(row[9])) : 0;
|
||||
e.expansion = row[10] ? static_cast<int32_t>(atoi(row[10])) : 0;
|
||||
e.prev_id = row[11] ? static_cast<int32_t>(atoi(row[11])) : -1;
|
||||
e.next_id = row[12] ? static_cast<int32_t>(atoi(row[12])) : -1;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -438,6 +439,86 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const AaRanks &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.upper_hotkey_sid));
|
||||
v.push_back(std::to_string(e.lower_hotkey_sid));
|
||||
v.push_back(std::to_string(e.title_sid));
|
||||
v.push_back(std::to_string(e.desc_sid));
|
||||
v.push_back(std::to_string(e.cost));
|
||||
v.push_back(std::to_string(e.level_req));
|
||||
v.push_back(std::to_string(e.spell));
|
||||
v.push_back(std::to_string(e.spell_type));
|
||||
v.push_back(std::to_string(e.recast_time));
|
||||
v.push_back(std::to_string(e.expansion));
|
||||
v.push_back(std::to_string(e.prev_id));
|
||||
v.push_back(std::to_string(e.next_id));
|
||||
|
||||
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<AaRanks> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.upper_hotkey_sid));
|
||||
v.push_back(std::to_string(e.lower_hotkey_sid));
|
||||
v.push_back(std::to_string(e.title_sid));
|
||||
v.push_back(std::to_string(e.desc_sid));
|
||||
v.push_back(std::to_string(e.cost));
|
||||
v.push_back(std::to_string(e.level_req));
|
||||
v.push_back(std::to_string(e.spell));
|
||||
v.push_back(std::to_string(e.spell_type));
|
||||
v.push_back(std::to_string(e.recast_time));
|
||||
v.push_back(std::to_string(e.expansion));
|
||||
v.push_back(std::to_string(e.prev_id));
|
||||
v.push_back(std::to_string(e.next_id));
|
||||
|
||||
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_AA_RANKS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_ACCOUNT_FLAGS_REPOSITORY_H
|
||||
@@ -112,8 +112,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
account_flags_id
|
||||
)
|
||||
);
|
||||
@@ -122,7 +123,7 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
AccountFlags e{};
|
||||
|
||||
e.p_accid = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.p_accid = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.p_flag = row[1] ? row[1] : "";
|
||||
e.p_value = row[2] ? row[2] : "";
|
||||
|
||||
@@ -250,7 +251,7 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AccountFlags e{};
|
||||
|
||||
e.p_accid = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.p_accid = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.p_flag = row[1] ? row[1] : "";
|
||||
e.p_value = row[2] ? row[2] : "";
|
||||
|
||||
@@ -277,7 +278,7 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AccountFlags e{};
|
||||
|
||||
e.p_accid = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.p_accid = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.p_flag = row[1] ? row[1] : "";
|
||||
e.p_value = row[2] ? row[2] : "";
|
||||
|
||||
@@ -338,6 +339,66 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const AccountFlags &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.p_accid));
|
||||
v.push_back("'" + Strings::Escape(e.p_flag) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.p_value) + "'");
|
||||
|
||||
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<AccountFlags> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.p_accid));
|
||||
v.push_back("'" + Strings::Escape(e.p_flag) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.p_value) + "'");
|
||||
|
||||
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_ACCOUNT_FLAGS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_ACCOUNT_IP_REPOSITORY_H
|
||||
@@ -116,8 +116,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
account_ip_id
|
||||
)
|
||||
);
|
||||
@@ -126,10 +127,10 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
AccountIp e{};
|
||||
|
||||
e.accid = static_cast<int32_t>(atoi(row[0]));
|
||||
e.accid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.ip = row[1] ? row[1] : "";
|
||||
e.count = static_cast<int32_t>(atoi(row[2]));
|
||||
e.lastused = row[3] ? row[3] : "";
|
||||
e.count = row[2] ? static_cast<int32_t>(atoi(row[2])) : 1;
|
||||
e.lastused = row[3] ? row[3] : std::time(nullptr);
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -258,10 +259,10 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AccountIp e{};
|
||||
|
||||
e.accid = static_cast<int32_t>(atoi(row[0]));
|
||||
e.accid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.ip = row[1] ? row[1] : "";
|
||||
e.count = static_cast<int32_t>(atoi(row[2]));
|
||||
e.lastused = row[3] ? row[3] : "";
|
||||
e.count = row[2] ? static_cast<int32_t>(atoi(row[2])) : 1;
|
||||
e.lastused = row[3] ? row[3] : std::time(nullptr);
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -286,10 +287,10 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AccountIp e{};
|
||||
|
||||
e.accid = static_cast<int32_t>(atoi(row[0]));
|
||||
e.accid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.ip = row[1] ? row[1] : "";
|
||||
e.count = static_cast<int32_t>(atoi(row[2]));
|
||||
e.lastused = row[3] ? row[3] : "";
|
||||
e.count = row[2] ? static_cast<int32_t>(atoi(row[2])) : 1;
|
||||
e.lastused = row[3] ? row[3] : std::time(nullptr);
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -348,6 +349,68 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const AccountIp &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
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) + "'");
|
||||
|
||||
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<AccountIp> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
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) + "'");
|
||||
|
||||
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_ACCOUNT_IP_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_ACCOUNT_REPOSITORY_H
|
||||
@@ -196,8 +196,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
account_id
|
||||
)
|
||||
);
|
||||
@@ -206,25 +207,25 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
Account e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
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 = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.sharedplat = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.password = row[4] ? row[4] : "";
|
||||
e.status = static_cast<int32_t>(atoi(row[5]));
|
||||
e.ls_id = row[6] ? row[6] : "";
|
||||
e.lsaccount_id = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.gmspeed = static_cast<uint8_t>(strtoul(row[8], nullptr, 10));
|
||||
e.invulnerable = static_cast<int8_t>(atoi(row[9]));
|
||||
e.flymode = static_cast<int8_t>(atoi(row[10]));
|
||||
e.ignore_tells = static_cast<int8_t>(atoi(row[11]));
|
||||
e.revoked = static_cast<uint8_t>(strtoul(row[12], nullptr, 10));
|
||||
e.karma = static_cast<uint32_t>(strtoul(row[13], nullptr, 10));
|
||||
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 = static_cast<int8_t>(atoi(row[15]));
|
||||
e.rulesflag = static_cast<uint8_t>(strtoul(row[16], nullptr, 10));
|
||||
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 = static_cast<uint32_t>(strtoul(row[18], 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] : "";
|
||||
@@ -417,25 +418,25 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
Account e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
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 = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.sharedplat = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.password = row[4] ? row[4] : "";
|
||||
e.status = static_cast<int32_t>(atoi(row[5]));
|
||||
e.ls_id = row[6] ? row[6] : "";
|
||||
e.lsaccount_id = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.gmspeed = static_cast<uint8_t>(strtoul(row[8], nullptr, 10));
|
||||
e.invulnerable = static_cast<int8_t>(atoi(row[9]));
|
||||
e.flymode = static_cast<int8_t>(atoi(row[10]));
|
||||
e.ignore_tells = static_cast<int8_t>(atoi(row[11]));
|
||||
e.revoked = static_cast<uint8_t>(strtoul(row[12], nullptr, 10));
|
||||
e.karma = static_cast<uint32_t>(strtoul(row[13], nullptr, 10));
|
||||
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 = static_cast<int8_t>(atoi(row[15]));
|
||||
e.rulesflag = static_cast<uint8_t>(strtoul(row[16], nullptr, 10));
|
||||
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 = static_cast<uint32_t>(strtoul(row[18], 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] : "";
|
||||
@@ -465,25 +466,25 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
Account e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
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 = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.sharedplat = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.password = row[4] ? row[4] : "";
|
||||
e.status = static_cast<int32_t>(atoi(row[5]));
|
||||
e.ls_id = row[6] ? row[6] : "";
|
||||
e.lsaccount_id = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.gmspeed = static_cast<uint8_t>(strtoul(row[8], nullptr, 10));
|
||||
e.invulnerable = static_cast<int8_t>(atoi(row[9]));
|
||||
e.flymode = static_cast<int8_t>(atoi(row[10]));
|
||||
e.ignore_tells = static_cast<int8_t>(atoi(row[11]));
|
||||
e.revoked = static_cast<uint8_t>(strtoul(row[12], nullptr, 10));
|
||||
e.karma = static_cast<uint32_t>(strtoul(row[13], nullptr, 10));
|
||||
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 = static_cast<int8_t>(atoi(row[15]));
|
||||
e.rulesflag = static_cast<uint8_t>(strtoul(row[16], nullptr, 10));
|
||||
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 = static_cast<uint32_t>(strtoul(row[18], 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] : "";
|
||||
@@ -547,6 +548,108 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const Account &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
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(std::to_string(e.sharedplat));
|
||||
v.push_back("'" + Strings::Escape(e.password) + "'");
|
||||
v.push_back(std::to_string(e.status));
|
||||
v.push_back("'" + Strings::Escape(e.ls_id) + "'");
|
||||
v.push_back(std::to_string(e.lsaccount_id));
|
||||
v.push_back(std::to_string(e.gmspeed));
|
||||
v.push_back(std::to_string(e.invulnerable));
|
||||
v.push_back(std::to_string(e.flymode));
|
||||
v.push_back(std::to_string(e.ignore_tells));
|
||||
v.push_back(std::to_string(e.revoked));
|
||||
v.push_back(std::to_string(e.karma));
|
||||
v.push_back("'" + Strings::Escape(e.minilogin_ip) + "'");
|
||||
v.push_back(std::to_string(e.hideme));
|
||||
v.push_back(std::to_string(e.rulesflag));
|
||||
v.push_back("FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "null") + ")");
|
||||
v.push_back(std::to_string(e.time_creation));
|
||||
v.push_back("'" + Strings::Escape(e.ban_reason) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.suspend_reason) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.crc_eqgame) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.crc_skillcaps) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.crc_basedata) + "'");
|
||||
|
||||
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<Account> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.charname) + "'");
|
||||
v.push_back(std::to_string(e.sharedplat));
|
||||
v.push_back("'" + Strings::Escape(e.password) + "'");
|
||||
v.push_back(std::to_string(e.status));
|
||||
v.push_back("'" + Strings::Escape(e.ls_id) + "'");
|
||||
v.push_back(std::to_string(e.lsaccount_id));
|
||||
v.push_back(std::to_string(e.gmspeed));
|
||||
v.push_back(std::to_string(e.invulnerable));
|
||||
v.push_back(std::to_string(e.flymode));
|
||||
v.push_back(std::to_string(e.ignore_tells));
|
||||
v.push_back(std::to_string(e.revoked));
|
||||
v.push_back(std::to_string(e.karma));
|
||||
v.push_back("'" + Strings::Escape(e.minilogin_ip) + "'");
|
||||
v.push_back(std::to_string(e.hideme));
|
||||
v.push_back(std::to_string(e.rulesflag));
|
||||
v.push_back("FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "null") + ")");
|
||||
v.push_back(std::to_string(e.time_creation));
|
||||
v.push_back("'" + Strings::Escape(e.ban_reason) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.suspend_reason) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.crc_eqgame) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.crc_skillcaps) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.crc_basedata) + "'");
|
||||
|
||||
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_ACCOUNT_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_ACCOUNT_REWARDS_REPOSITORY_H
|
||||
@@ -112,8 +112,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
account_rewards_id
|
||||
)
|
||||
);
|
||||
@@ -122,9 +123,9 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
AccountRewards e{};
|
||||
|
||||
e.account_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.reward_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.amount = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.account_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.reward_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.amount = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -250,9 +251,9 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AccountRewards e{};
|
||||
|
||||
e.account_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.reward_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.amount = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.account_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.reward_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.amount = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -277,9 +278,9 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AccountRewards e{};
|
||||
|
||||
e.account_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.reward_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.amount = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.account_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.reward_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.amount = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -338,6 +339,66 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const AccountRewards &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.account_id));
|
||||
v.push_back(std::to_string(e.reward_id));
|
||||
v.push_back(std::to_string(e.amount));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int ReplaceMany(
|
||||
Database& db,
|
||||
const std::vector<AccountRewards> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.account_id));
|
||||
v.push_back(std::to_string(e.reward_id));
|
||||
v.push_back(std::to_string(e.amount));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_ACCOUNT_REWARDS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_ADVENTURE_DETAILS_REPOSITORY_H
|
||||
@@ -136,8 +136,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
adventure_details_id
|
||||
)
|
||||
);
|
||||
@@ -146,15 +147,15 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
AdventureDetails e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.adventure_id = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.instance_id = static_cast<int32_t>(atoi(row[2]));
|
||||
e.count = static_cast<uint16_t>(strtoul(row[3], nullptr, 10));
|
||||
e.assassinate_count = static_cast<uint16_t>(strtoul(row[4], nullptr, 10));
|
||||
e.status = static_cast<uint8_t>(strtoul(row[5], nullptr, 10));
|
||||
e.time_created = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.time_zoned = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.time_completed = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.adventure_id = row[1] ? static_cast<uint16_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.instance_id = row[2] ? static_cast<int32_t>(atoi(row[2])) : -1;
|
||||
e.count = row[3] ? static_cast<uint16_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.assassinate_count = row[4] ? static_cast<uint16_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.status = row[5] ? static_cast<uint8_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.time_created = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.time_zoned = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.time_completed = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -297,15 +298,15 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AdventureDetails e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.adventure_id = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.instance_id = static_cast<int32_t>(atoi(row[2]));
|
||||
e.count = static_cast<uint16_t>(strtoul(row[3], nullptr, 10));
|
||||
e.assassinate_count = static_cast<uint16_t>(strtoul(row[4], nullptr, 10));
|
||||
e.status = static_cast<uint8_t>(strtoul(row[5], nullptr, 10));
|
||||
e.time_created = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.time_zoned = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.time_completed = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.adventure_id = row[1] ? static_cast<uint16_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.instance_id = row[2] ? static_cast<int32_t>(atoi(row[2])) : -1;
|
||||
e.count = row[3] ? static_cast<uint16_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.assassinate_count = row[4] ? static_cast<uint16_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.status = row[5] ? static_cast<uint8_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.time_created = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.time_zoned = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.time_completed = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -330,15 +331,15 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AdventureDetails e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.adventure_id = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.instance_id = static_cast<int32_t>(atoi(row[2]));
|
||||
e.count = static_cast<uint16_t>(strtoul(row[3], nullptr, 10));
|
||||
e.assassinate_count = static_cast<uint16_t>(strtoul(row[4], nullptr, 10));
|
||||
e.status = static_cast<uint8_t>(strtoul(row[5], nullptr, 10));
|
||||
e.time_created = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.time_zoned = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.time_completed = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.adventure_id = row[1] ? static_cast<uint16_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.instance_id = row[2] ? static_cast<int32_t>(atoi(row[2])) : -1;
|
||||
e.count = row[3] ? static_cast<uint16_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.assassinate_count = row[4] ? static_cast<uint16_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.status = row[5] ? static_cast<uint8_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.time_created = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.time_zoned = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.time_completed = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -397,6 +398,78 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const AdventureDetails &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.adventure_id));
|
||||
v.push_back(std::to_string(e.instance_id));
|
||||
v.push_back(std::to_string(e.count));
|
||||
v.push_back(std::to_string(e.assassinate_count));
|
||||
v.push_back(std::to_string(e.status));
|
||||
v.push_back(std::to_string(e.time_created));
|
||||
v.push_back(std::to_string(e.time_zoned));
|
||||
v.push_back(std::to_string(e.time_completed));
|
||||
|
||||
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<AdventureDetails> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.adventure_id));
|
||||
v.push_back(std::to_string(e.instance_id));
|
||||
v.push_back(std::to_string(e.count));
|
||||
v.push_back(std::to_string(e.assassinate_count));
|
||||
v.push_back(std::to_string(e.status));
|
||||
v.push_back(std::to_string(e.time_created));
|
||||
v.push_back(std::to_string(e.time_zoned));
|
||||
v.push_back(std::to_string(e.time_completed));
|
||||
|
||||
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_ADVENTURE_DETAILS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_ADVENTURE_MEMBERS_REPOSITORY_H
|
||||
@@ -108,8 +108,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
adventure_members_id
|
||||
)
|
||||
);
|
||||
@@ -118,8 +119,8 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
AdventureMembers e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.charid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.charid = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -242,8 +243,8 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AdventureMembers e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.charid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.charid = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -268,8 +269,8 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AdventureMembers e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.charid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.charid = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -328,6 +329,64 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const AdventureMembers &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.charid));
|
||||
|
||||
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<AdventureMembers> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.charid));
|
||||
|
||||
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_ADVENTURE_MEMBERS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_ADVENTURE_STATS_REPOSITORY_H
|
||||
@@ -144,8 +144,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
adventure_stats_id
|
||||
)
|
||||
);
|
||||
@@ -154,17 +155,17 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
AdventureStats e{};
|
||||
|
||||
e.player_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.guk_wins = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.mir_wins = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.mmc_wins = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.ruj_wins = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.tak_wins = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.guk_losses = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.mir_losses = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.mmc_losses = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.ruj_losses = static_cast<uint32_t>(strtoul(row[9], nullptr, 10));
|
||||
e.tak_losses = static_cast<uint32_t>(strtoul(row[10], nullptr, 10));
|
||||
e.player_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.guk_wins = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.mir_wins = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.mmc_wins = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.ruj_wins = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.tak_wins = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.guk_losses = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.mir_losses = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.mmc_losses = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.ruj_losses = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.tak_losses = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -314,17 +315,17 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AdventureStats e{};
|
||||
|
||||
e.player_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.guk_wins = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.mir_wins = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.mmc_wins = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.ruj_wins = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.tak_wins = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.guk_losses = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.mir_losses = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.mmc_losses = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.ruj_losses = static_cast<uint32_t>(strtoul(row[9], nullptr, 10));
|
||||
e.tak_losses = static_cast<uint32_t>(strtoul(row[10], nullptr, 10));
|
||||
e.player_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.guk_wins = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.mir_wins = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.mmc_wins = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.ruj_wins = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.tak_wins = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.guk_losses = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.mir_losses = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.mmc_losses = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.ruj_losses = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.tak_losses = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -349,17 +350,17 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AdventureStats e{};
|
||||
|
||||
e.player_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.guk_wins = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.mir_wins = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.mmc_wins = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.ruj_wins = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.tak_wins = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.guk_losses = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.mir_losses = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.mmc_losses = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.ruj_losses = static_cast<uint32_t>(strtoul(row[9], nullptr, 10));
|
||||
e.tak_losses = static_cast<uint32_t>(strtoul(row[10], nullptr, 10));
|
||||
e.player_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.guk_wins = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.mir_wins = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.mmc_wins = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.ruj_wins = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.tak_wins = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.guk_losses = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.mir_losses = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.mmc_losses = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.ruj_losses = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.tak_losses = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -418,6 +419,82 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const AdventureStats &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.player_id));
|
||||
v.push_back(std::to_string(e.guk_wins));
|
||||
v.push_back(std::to_string(e.mir_wins));
|
||||
v.push_back(std::to_string(e.mmc_wins));
|
||||
v.push_back(std::to_string(e.ruj_wins));
|
||||
v.push_back(std::to_string(e.tak_wins));
|
||||
v.push_back(std::to_string(e.guk_losses));
|
||||
v.push_back(std::to_string(e.mir_losses));
|
||||
v.push_back(std::to_string(e.mmc_losses));
|
||||
v.push_back(std::to_string(e.ruj_losses));
|
||||
v.push_back(std::to_string(e.tak_losses));
|
||||
|
||||
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<AdventureStats> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.player_id));
|
||||
v.push_back(std::to_string(e.guk_wins));
|
||||
v.push_back(std::to_string(e.mir_wins));
|
||||
v.push_back(std::to_string(e.mmc_wins));
|
||||
v.push_back(std::to_string(e.ruj_wins));
|
||||
v.push_back(std::to_string(e.tak_wins));
|
||||
v.push_back(std::to_string(e.guk_losses));
|
||||
v.push_back(std::to_string(e.mir_losses));
|
||||
v.push_back(std::to_string(e.mmc_losses));
|
||||
v.push_back(std::to_string(e.ruj_losses));
|
||||
v.push_back(std::to_string(e.tak_losses));
|
||||
|
||||
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_ADVENTURE_STATS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_ADVENTURE_TEMPLATE_ENTRY_FLAVOR_REPOSITORY_H
|
||||
@@ -108,8 +108,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
adventure_template_entry_flavor_id
|
||||
)
|
||||
);
|
||||
@@ -118,7 +119,7 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
AdventureTemplateEntryFlavor e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.text = row[1] ? row[1] : "";
|
||||
|
||||
return e;
|
||||
@@ -242,7 +243,7 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AdventureTemplateEntryFlavor e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.text = row[1] ? row[1] : "";
|
||||
|
||||
all_entries.push_back(e);
|
||||
@@ -268,7 +269,7 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AdventureTemplateEntryFlavor e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.text = row[1] ? row[1] : "";
|
||||
|
||||
all_entries.push_back(e);
|
||||
@@ -328,6 +329,64 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const AdventureTemplateEntryFlavor &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back("'" + Strings::Escape(e.text) + "'");
|
||||
|
||||
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<AdventureTemplateEntryFlavor> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back("'" + Strings::Escape(e.text) + "'");
|
||||
|
||||
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_ADVENTURE_TEMPLATE_ENTRY_FLAVOR_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_ADVENTURE_TEMPLATE_ENTRY_REPOSITORY_H
|
||||
@@ -108,8 +108,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
adventure_template_entry_id
|
||||
)
|
||||
);
|
||||
@@ -118,8 +119,8 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
AdventureTemplateEntry e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.template_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.template_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -242,8 +243,8 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AdventureTemplateEntry e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.template_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.template_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -268,8 +269,8 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AdventureTemplateEntry e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.template_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.template_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -328,6 +329,64 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const AdventureTemplateEntry &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.template_id));
|
||||
|
||||
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<AdventureTemplateEntry> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.template_id));
|
||||
|
||||
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_ADVENTURE_TEMPLATE_ENTRY_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_ADVENTURE_TEMPLATE_REPOSITORY_H
|
||||
@@ -232,8 +232,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
adventure_template_id
|
||||
)
|
||||
);
|
||||
@@ -242,38 +243,38 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
AdventureTemplate e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.zone = row[1] ? row[1] : "";
|
||||
e.zone_version = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.is_hard = static_cast<uint8_t>(strtoul(row[3], nullptr, 10));
|
||||
e.is_raid = static_cast<uint8_t>(strtoul(row[4], nullptr, 10));
|
||||
e.min_level = static_cast<uint8_t>(strtoul(row[5], nullptr, 10));
|
||||
e.max_level = static_cast<uint8_t>(strtoul(row[6], nullptr, 10));
|
||||
e.type = static_cast<uint8_t>(strtoul(row[7], nullptr, 10));
|
||||
e.type_data = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.type_count = static_cast<uint16_t>(strtoul(row[9], nullptr, 10));
|
||||
e.assa_x = strtof(row[10], nullptr);
|
||||
e.assa_y = strtof(row[11], nullptr);
|
||||
e.assa_z = strtof(row[12], nullptr);
|
||||
e.assa_h = strtof(row[13], nullptr);
|
||||
e.zone_version = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.is_hard = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.is_raid = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.min_level = row[5] ? static_cast<uint8_t>(strtoul(row[5], nullptr, 10)) : 1;
|
||||
e.max_level = row[6] ? static_cast<uint8_t>(strtoul(row[6], nullptr, 10)) : 65;
|
||||
e.type = row[7] ? static_cast<uint8_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.type_data = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.type_count = row[9] ? static_cast<uint16_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.assa_x = row[10] ? strtof(row[10], nullptr) : 0;
|
||||
e.assa_y = row[11] ? strtof(row[11], nullptr) : 0;
|
||||
e.assa_z = row[12] ? strtof(row[12], nullptr) : 0;
|
||||
e.assa_h = row[13] ? strtof(row[13], nullptr) : 0;
|
||||
e.text = row[14] ? row[14] : "";
|
||||
e.duration = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
||||
e.zone_in_time = static_cast<uint32_t>(strtoul(row[16], nullptr, 10));
|
||||
e.win_points = static_cast<uint16_t>(strtoul(row[17], nullptr, 10));
|
||||
e.lose_points = static_cast<uint16_t>(strtoul(row[18], nullptr, 10));
|
||||
e.theme = static_cast<uint8_t>(strtoul(row[19], nullptr, 10));
|
||||
e.zone_in_zone_id = static_cast<uint16_t>(strtoul(row[20], nullptr, 10));
|
||||
e.zone_in_x = strtof(row[21], nullptr);
|
||||
e.zone_in_y = strtof(row[22], nullptr);
|
||||
e.zone_in_object_id = static_cast<int16_t>(atoi(row[23]));
|
||||
e.dest_x = strtof(row[24], nullptr);
|
||||
e.dest_y = strtof(row[25], nullptr);
|
||||
e.dest_z = strtof(row[26], nullptr);
|
||||
e.dest_h = strtof(row[27], nullptr);
|
||||
e.graveyard_zone_id = static_cast<uint32_t>(strtoul(row[28], nullptr, 10));
|
||||
e.graveyard_x = strtof(row[29], nullptr);
|
||||
e.graveyard_y = strtof(row[30], nullptr);
|
||||
e.graveyard_z = strtof(row[31], nullptr);
|
||||
e.duration = row[15] ? static_cast<uint32_t>(strtoul(row[15], nullptr, 10)) : 7200;
|
||||
e.zone_in_time = row[16] ? static_cast<uint32_t>(strtoul(row[16], nullptr, 10)) : 1800;
|
||||
e.win_points = row[17] ? static_cast<uint16_t>(strtoul(row[17], nullptr, 10)) : 0;
|
||||
e.lose_points = row[18] ? static_cast<uint16_t>(strtoul(row[18], nullptr, 10)) : 0;
|
||||
e.theme = row[19] ? static_cast<uint8_t>(strtoul(row[19], nullptr, 10)) : 1;
|
||||
e.zone_in_zone_id = row[20] ? static_cast<uint16_t>(strtoul(row[20], nullptr, 10)) : 0;
|
||||
e.zone_in_x = row[21] ? strtof(row[21], nullptr) : 0;
|
||||
e.zone_in_y = row[22] ? strtof(row[22], nullptr) : 0;
|
||||
e.zone_in_object_id = row[23] ? static_cast<int16_t>(atoi(row[23])) : 0;
|
||||
e.dest_x = row[24] ? strtof(row[24], nullptr) : 0;
|
||||
e.dest_y = row[25] ? strtof(row[25], nullptr) : 0;
|
||||
e.dest_z = row[26] ? strtof(row[26], nullptr) : 0;
|
||||
e.dest_h = row[27] ? strtof(row[27], nullptr) : 0;
|
||||
e.graveyard_zone_id = row[28] ? static_cast<uint32_t>(strtoul(row[28], nullptr, 10)) : 0;
|
||||
e.graveyard_x = row[29] ? strtof(row[29], nullptr) : 0;
|
||||
e.graveyard_y = row[30] ? strtof(row[30], nullptr) : 0;
|
||||
e.graveyard_z = row[31] ? strtof(row[31], nullptr) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -489,38 +490,38 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AdventureTemplate e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.zone = row[1] ? row[1] : "";
|
||||
e.zone_version = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.is_hard = static_cast<uint8_t>(strtoul(row[3], nullptr, 10));
|
||||
e.is_raid = static_cast<uint8_t>(strtoul(row[4], nullptr, 10));
|
||||
e.min_level = static_cast<uint8_t>(strtoul(row[5], nullptr, 10));
|
||||
e.max_level = static_cast<uint8_t>(strtoul(row[6], nullptr, 10));
|
||||
e.type = static_cast<uint8_t>(strtoul(row[7], nullptr, 10));
|
||||
e.type_data = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.type_count = static_cast<uint16_t>(strtoul(row[9], nullptr, 10));
|
||||
e.assa_x = strtof(row[10], nullptr);
|
||||
e.assa_y = strtof(row[11], nullptr);
|
||||
e.assa_z = strtof(row[12], nullptr);
|
||||
e.assa_h = strtof(row[13], nullptr);
|
||||
e.zone_version = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.is_hard = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.is_raid = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.min_level = row[5] ? static_cast<uint8_t>(strtoul(row[5], nullptr, 10)) : 1;
|
||||
e.max_level = row[6] ? static_cast<uint8_t>(strtoul(row[6], nullptr, 10)) : 65;
|
||||
e.type = row[7] ? static_cast<uint8_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.type_data = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.type_count = row[9] ? static_cast<uint16_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.assa_x = row[10] ? strtof(row[10], nullptr) : 0;
|
||||
e.assa_y = row[11] ? strtof(row[11], nullptr) : 0;
|
||||
e.assa_z = row[12] ? strtof(row[12], nullptr) : 0;
|
||||
e.assa_h = row[13] ? strtof(row[13], nullptr) : 0;
|
||||
e.text = row[14] ? row[14] : "";
|
||||
e.duration = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
||||
e.zone_in_time = static_cast<uint32_t>(strtoul(row[16], nullptr, 10));
|
||||
e.win_points = static_cast<uint16_t>(strtoul(row[17], nullptr, 10));
|
||||
e.lose_points = static_cast<uint16_t>(strtoul(row[18], nullptr, 10));
|
||||
e.theme = static_cast<uint8_t>(strtoul(row[19], nullptr, 10));
|
||||
e.zone_in_zone_id = static_cast<uint16_t>(strtoul(row[20], nullptr, 10));
|
||||
e.zone_in_x = strtof(row[21], nullptr);
|
||||
e.zone_in_y = strtof(row[22], nullptr);
|
||||
e.zone_in_object_id = static_cast<int16_t>(atoi(row[23]));
|
||||
e.dest_x = strtof(row[24], nullptr);
|
||||
e.dest_y = strtof(row[25], nullptr);
|
||||
e.dest_z = strtof(row[26], nullptr);
|
||||
e.dest_h = strtof(row[27], nullptr);
|
||||
e.graveyard_zone_id = static_cast<uint32_t>(strtoul(row[28], nullptr, 10));
|
||||
e.graveyard_x = strtof(row[29], nullptr);
|
||||
e.graveyard_y = strtof(row[30], nullptr);
|
||||
e.graveyard_z = strtof(row[31], nullptr);
|
||||
e.duration = row[15] ? static_cast<uint32_t>(strtoul(row[15], nullptr, 10)) : 7200;
|
||||
e.zone_in_time = row[16] ? static_cast<uint32_t>(strtoul(row[16], nullptr, 10)) : 1800;
|
||||
e.win_points = row[17] ? static_cast<uint16_t>(strtoul(row[17], nullptr, 10)) : 0;
|
||||
e.lose_points = row[18] ? static_cast<uint16_t>(strtoul(row[18], nullptr, 10)) : 0;
|
||||
e.theme = row[19] ? static_cast<uint8_t>(strtoul(row[19], nullptr, 10)) : 1;
|
||||
e.zone_in_zone_id = row[20] ? static_cast<uint16_t>(strtoul(row[20], nullptr, 10)) : 0;
|
||||
e.zone_in_x = row[21] ? strtof(row[21], nullptr) : 0;
|
||||
e.zone_in_y = row[22] ? strtof(row[22], nullptr) : 0;
|
||||
e.zone_in_object_id = row[23] ? static_cast<int16_t>(atoi(row[23])) : 0;
|
||||
e.dest_x = row[24] ? strtof(row[24], nullptr) : 0;
|
||||
e.dest_y = row[25] ? strtof(row[25], nullptr) : 0;
|
||||
e.dest_z = row[26] ? strtof(row[26], nullptr) : 0;
|
||||
e.dest_h = row[27] ? strtof(row[27], nullptr) : 0;
|
||||
e.graveyard_zone_id = row[28] ? static_cast<uint32_t>(strtoul(row[28], nullptr, 10)) : 0;
|
||||
e.graveyard_x = row[29] ? strtof(row[29], nullptr) : 0;
|
||||
e.graveyard_y = row[30] ? strtof(row[30], nullptr) : 0;
|
||||
e.graveyard_z = row[31] ? strtof(row[31], nullptr) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -545,38 +546,38 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AdventureTemplate e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.zone = row[1] ? row[1] : "";
|
||||
e.zone_version = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.is_hard = static_cast<uint8_t>(strtoul(row[3], nullptr, 10));
|
||||
e.is_raid = static_cast<uint8_t>(strtoul(row[4], nullptr, 10));
|
||||
e.min_level = static_cast<uint8_t>(strtoul(row[5], nullptr, 10));
|
||||
e.max_level = static_cast<uint8_t>(strtoul(row[6], nullptr, 10));
|
||||
e.type = static_cast<uint8_t>(strtoul(row[7], nullptr, 10));
|
||||
e.type_data = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.type_count = static_cast<uint16_t>(strtoul(row[9], nullptr, 10));
|
||||
e.assa_x = strtof(row[10], nullptr);
|
||||
e.assa_y = strtof(row[11], nullptr);
|
||||
e.assa_z = strtof(row[12], nullptr);
|
||||
e.assa_h = strtof(row[13], nullptr);
|
||||
e.zone_version = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.is_hard = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.is_raid = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.min_level = row[5] ? static_cast<uint8_t>(strtoul(row[5], nullptr, 10)) : 1;
|
||||
e.max_level = row[6] ? static_cast<uint8_t>(strtoul(row[6], nullptr, 10)) : 65;
|
||||
e.type = row[7] ? static_cast<uint8_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.type_data = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.type_count = row[9] ? static_cast<uint16_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.assa_x = row[10] ? strtof(row[10], nullptr) : 0;
|
||||
e.assa_y = row[11] ? strtof(row[11], nullptr) : 0;
|
||||
e.assa_z = row[12] ? strtof(row[12], nullptr) : 0;
|
||||
e.assa_h = row[13] ? strtof(row[13], nullptr) : 0;
|
||||
e.text = row[14] ? row[14] : "";
|
||||
e.duration = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
||||
e.zone_in_time = static_cast<uint32_t>(strtoul(row[16], nullptr, 10));
|
||||
e.win_points = static_cast<uint16_t>(strtoul(row[17], nullptr, 10));
|
||||
e.lose_points = static_cast<uint16_t>(strtoul(row[18], nullptr, 10));
|
||||
e.theme = static_cast<uint8_t>(strtoul(row[19], nullptr, 10));
|
||||
e.zone_in_zone_id = static_cast<uint16_t>(strtoul(row[20], nullptr, 10));
|
||||
e.zone_in_x = strtof(row[21], nullptr);
|
||||
e.zone_in_y = strtof(row[22], nullptr);
|
||||
e.zone_in_object_id = static_cast<int16_t>(atoi(row[23]));
|
||||
e.dest_x = strtof(row[24], nullptr);
|
||||
e.dest_y = strtof(row[25], nullptr);
|
||||
e.dest_z = strtof(row[26], nullptr);
|
||||
e.dest_h = strtof(row[27], nullptr);
|
||||
e.graveyard_zone_id = static_cast<uint32_t>(strtoul(row[28], nullptr, 10));
|
||||
e.graveyard_x = strtof(row[29], nullptr);
|
||||
e.graveyard_y = strtof(row[30], nullptr);
|
||||
e.graveyard_z = strtof(row[31], nullptr);
|
||||
e.duration = row[15] ? static_cast<uint32_t>(strtoul(row[15], nullptr, 10)) : 7200;
|
||||
e.zone_in_time = row[16] ? static_cast<uint32_t>(strtoul(row[16], nullptr, 10)) : 1800;
|
||||
e.win_points = row[17] ? static_cast<uint16_t>(strtoul(row[17], nullptr, 10)) : 0;
|
||||
e.lose_points = row[18] ? static_cast<uint16_t>(strtoul(row[18], nullptr, 10)) : 0;
|
||||
e.theme = row[19] ? static_cast<uint8_t>(strtoul(row[19], nullptr, 10)) : 1;
|
||||
e.zone_in_zone_id = row[20] ? static_cast<uint16_t>(strtoul(row[20], nullptr, 10)) : 0;
|
||||
e.zone_in_x = row[21] ? strtof(row[21], nullptr) : 0;
|
||||
e.zone_in_y = row[22] ? strtof(row[22], nullptr) : 0;
|
||||
e.zone_in_object_id = row[23] ? static_cast<int16_t>(atoi(row[23])) : 0;
|
||||
e.dest_x = row[24] ? strtof(row[24], nullptr) : 0;
|
||||
e.dest_y = row[25] ? strtof(row[25], nullptr) : 0;
|
||||
e.dest_z = row[26] ? strtof(row[26], nullptr) : 0;
|
||||
e.dest_h = row[27] ? strtof(row[27], nullptr) : 0;
|
||||
e.graveyard_zone_id = row[28] ? static_cast<uint32_t>(strtoul(row[28], nullptr, 10)) : 0;
|
||||
e.graveyard_x = row[29] ? strtof(row[29], nullptr) : 0;
|
||||
e.graveyard_y = row[30] ? strtof(row[30], nullptr) : 0;
|
||||
e.graveyard_z = row[31] ? strtof(row[31], nullptr) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -635,6 +636,126 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const AdventureTemplate &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back("'" + Strings::Escape(e.zone) + "'");
|
||||
v.push_back(std::to_string(e.zone_version));
|
||||
v.push_back(std::to_string(e.is_hard));
|
||||
v.push_back(std::to_string(e.is_raid));
|
||||
v.push_back(std::to_string(e.min_level));
|
||||
v.push_back(std::to_string(e.max_level));
|
||||
v.push_back(std::to_string(e.type));
|
||||
v.push_back(std::to_string(e.type_data));
|
||||
v.push_back(std::to_string(e.type_count));
|
||||
v.push_back(std::to_string(e.assa_x));
|
||||
v.push_back(std::to_string(e.assa_y));
|
||||
v.push_back(std::to_string(e.assa_z));
|
||||
v.push_back(std::to_string(e.assa_h));
|
||||
v.push_back("'" + Strings::Escape(e.text) + "'");
|
||||
v.push_back(std::to_string(e.duration));
|
||||
v.push_back(std::to_string(e.zone_in_time));
|
||||
v.push_back(std::to_string(e.win_points));
|
||||
v.push_back(std::to_string(e.lose_points));
|
||||
v.push_back(std::to_string(e.theme));
|
||||
v.push_back(std::to_string(e.zone_in_zone_id));
|
||||
v.push_back(std::to_string(e.zone_in_x));
|
||||
v.push_back(std::to_string(e.zone_in_y));
|
||||
v.push_back(std::to_string(e.zone_in_object_id));
|
||||
v.push_back(std::to_string(e.dest_x));
|
||||
v.push_back(std::to_string(e.dest_y));
|
||||
v.push_back(std::to_string(e.dest_z));
|
||||
v.push_back(std::to_string(e.dest_h));
|
||||
v.push_back(std::to_string(e.graveyard_zone_id));
|
||||
v.push_back(std::to_string(e.graveyard_x));
|
||||
v.push_back(std::to_string(e.graveyard_y));
|
||||
v.push_back(std::to_string(e.graveyard_z));
|
||||
v.push_back(std::to_string(e.graveyard_radius));
|
||||
|
||||
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<AdventureTemplate> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back("'" + Strings::Escape(e.zone) + "'");
|
||||
v.push_back(std::to_string(e.zone_version));
|
||||
v.push_back(std::to_string(e.is_hard));
|
||||
v.push_back(std::to_string(e.is_raid));
|
||||
v.push_back(std::to_string(e.min_level));
|
||||
v.push_back(std::to_string(e.max_level));
|
||||
v.push_back(std::to_string(e.type));
|
||||
v.push_back(std::to_string(e.type_data));
|
||||
v.push_back(std::to_string(e.type_count));
|
||||
v.push_back(std::to_string(e.assa_x));
|
||||
v.push_back(std::to_string(e.assa_y));
|
||||
v.push_back(std::to_string(e.assa_z));
|
||||
v.push_back(std::to_string(e.assa_h));
|
||||
v.push_back("'" + Strings::Escape(e.text) + "'");
|
||||
v.push_back(std::to_string(e.duration));
|
||||
v.push_back(std::to_string(e.zone_in_time));
|
||||
v.push_back(std::to_string(e.win_points));
|
||||
v.push_back(std::to_string(e.lose_points));
|
||||
v.push_back(std::to_string(e.theme));
|
||||
v.push_back(std::to_string(e.zone_in_zone_id));
|
||||
v.push_back(std::to_string(e.zone_in_x));
|
||||
v.push_back(std::to_string(e.zone_in_y));
|
||||
v.push_back(std::to_string(e.zone_in_object_id));
|
||||
v.push_back(std::to_string(e.dest_x));
|
||||
v.push_back(std::to_string(e.dest_y));
|
||||
v.push_back(std::to_string(e.dest_z));
|
||||
v.push_back(std::to_string(e.dest_h));
|
||||
v.push_back(std::to_string(e.graveyard_zone_id));
|
||||
v.push_back(std::to_string(e.graveyard_x));
|
||||
v.push_back(std::to_string(e.graveyard_y));
|
||||
v.push_back(std::to_string(e.graveyard_z));
|
||||
v.push_back(std::to_string(e.graveyard_radius));
|
||||
|
||||
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_ADVENTURE_TEMPLATE_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_ALTERNATE_CURRENCY_REPOSITORY_H
|
||||
@@ -108,8 +108,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
alternate_currency_id
|
||||
)
|
||||
);
|
||||
@@ -118,8 +119,8 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
AlternateCurrency e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.item_id = static_cast<int32_t>(atoi(row[1]));
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.item_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -242,8 +243,8 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AlternateCurrency e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.item_id = static_cast<int32_t>(atoi(row[1]));
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.item_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -268,8 +269,8 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
AlternateCurrency e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.item_id = static_cast<int32_t>(atoi(row[1]));
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.item_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -328,6 +329,64 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const AlternateCurrency &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
|
||||
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<AlternateCurrency> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
|
||||
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_ALTERNATE_CURRENCY_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_AURAS_REPOSITORY_H
|
||||
@@ -144,8 +144,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
auras_id
|
||||
)
|
||||
);
|
||||
@@ -154,17 +155,17 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
Auras e{};
|
||||
|
||||
e.type = static_cast<int32_t>(atoi(row[0]));
|
||||
e.npc_type = static_cast<int32_t>(atoi(row[1]));
|
||||
e.type = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.npc_type = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.name = row[2] ? row[2] : "";
|
||||
e.spell_id = static_cast<int32_t>(atoi(row[3]));
|
||||
e.distance = static_cast<int32_t>(atoi(row[4]));
|
||||
e.aura_type = static_cast<int32_t>(atoi(row[5]));
|
||||
e.spawn_type = static_cast<int32_t>(atoi(row[6]));
|
||||
e.movement = static_cast<int32_t>(atoi(row[7]));
|
||||
e.duration = static_cast<int32_t>(atoi(row[8]));
|
||||
e.icon = static_cast<int32_t>(atoi(row[9]));
|
||||
e.cast_time = static_cast<int32_t>(atoi(row[10]));
|
||||
e.spell_id = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
e.distance = row[4] ? static_cast<int32_t>(atoi(row[4])) : 60;
|
||||
e.aura_type = row[5] ? static_cast<int32_t>(atoi(row[5])) : 1;
|
||||
e.spawn_type = row[6] ? static_cast<int32_t>(atoi(row[6])) : 0;
|
||||
e.movement = row[7] ? static_cast<int32_t>(atoi(row[7])) : 0;
|
||||
e.duration = row[8] ? static_cast<int32_t>(atoi(row[8])) : 5400;
|
||||
e.icon = row[9] ? static_cast<int32_t>(atoi(row[9])) : -1;
|
||||
e.cast_time = row[10] ? static_cast<int32_t>(atoi(row[10])) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -314,17 +315,17 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
Auras e{};
|
||||
|
||||
e.type = static_cast<int32_t>(atoi(row[0]));
|
||||
e.npc_type = static_cast<int32_t>(atoi(row[1]));
|
||||
e.type = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.npc_type = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.name = row[2] ? row[2] : "";
|
||||
e.spell_id = static_cast<int32_t>(atoi(row[3]));
|
||||
e.distance = static_cast<int32_t>(atoi(row[4]));
|
||||
e.aura_type = static_cast<int32_t>(atoi(row[5]));
|
||||
e.spawn_type = static_cast<int32_t>(atoi(row[6]));
|
||||
e.movement = static_cast<int32_t>(atoi(row[7]));
|
||||
e.duration = static_cast<int32_t>(atoi(row[8]));
|
||||
e.icon = static_cast<int32_t>(atoi(row[9]));
|
||||
e.cast_time = static_cast<int32_t>(atoi(row[10]));
|
||||
e.spell_id = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
e.distance = row[4] ? static_cast<int32_t>(atoi(row[4])) : 60;
|
||||
e.aura_type = row[5] ? static_cast<int32_t>(atoi(row[5])) : 1;
|
||||
e.spawn_type = row[6] ? static_cast<int32_t>(atoi(row[6])) : 0;
|
||||
e.movement = row[7] ? static_cast<int32_t>(atoi(row[7])) : 0;
|
||||
e.duration = row[8] ? static_cast<int32_t>(atoi(row[8])) : 5400;
|
||||
e.icon = row[9] ? static_cast<int32_t>(atoi(row[9])) : -1;
|
||||
e.cast_time = row[10] ? static_cast<int32_t>(atoi(row[10])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -349,17 +350,17 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
Auras e{};
|
||||
|
||||
e.type = static_cast<int32_t>(atoi(row[0]));
|
||||
e.npc_type = static_cast<int32_t>(atoi(row[1]));
|
||||
e.type = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.npc_type = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.name = row[2] ? row[2] : "";
|
||||
e.spell_id = static_cast<int32_t>(atoi(row[3]));
|
||||
e.distance = static_cast<int32_t>(atoi(row[4]));
|
||||
e.aura_type = static_cast<int32_t>(atoi(row[5]));
|
||||
e.spawn_type = static_cast<int32_t>(atoi(row[6]));
|
||||
e.movement = static_cast<int32_t>(atoi(row[7]));
|
||||
e.duration = static_cast<int32_t>(atoi(row[8]));
|
||||
e.icon = static_cast<int32_t>(atoi(row[9]));
|
||||
e.cast_time = static_cast<int32_t>(atoi(row[10]));
|
||||
e.spell_id = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
e.distance = row[4] ? static_cast<int32_t>(atoi(row[4])) : 60;
|
||||
e.aura_type = row[5] ? static_cast<int32_t>(atoi(row[5])) : 1;
|
||||
e.spawn_type = row[6] ? static_cast<int32_t>(atoi(row[6])) : 0;
|
||||
e.movement = row[7] ? static_cast<int32_t>(atoi(row[7])) : 0;
|
||||
e.duration = row[8] ? static_cast<int32_t>(atoi(row[8])) : 5400;
|
||||
e.icon = row[9] ? static_cast<int32_t>(atoi(row[9])) : -1;
|
||||
e.cast_time = row[10] ? static_cast<int32_t>(atoi(row[10])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -418,6 +419,82 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const Auras &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.type));
|
||||
v.push_back(std::to_string(e.npc_type));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
v.push_back(std::to_string(e.spell_id));
|
||||
v.push_back(std::to_string(e.distance));
|
||||
v.push_back(std::to_string(e.aura_type));
|
||||
v.push_back(std::to_string(e.spawn_type));
|
||||
v.push_back(std::to_string(e.movement));
|
||||
v.push_back(std::to_string(e.duration));
|
||||
v.push_back(std::to_string(e.icon));
|
||||
v.push_back(std::to_string(e.cast_time));
|
||||
|
||||
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<Auras> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.type));
|
||||
v.push_back(std::to_string(e.npc_type));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
v.push_back(std::to_string(e.spell_id));
|
||||
v.push_back(std::to_string(e.distance));
|
||||
v.push_back(std::to_string(e.aura_type));
|
||||
v.push_back(std::to_string(e.spawn_type));
|
||||
v.push_back(std::to_string(e.movement));
|
||||
v.push_back(std::to_string(e.duration));
|
||||
v.push_back(std::to_string(e.icon));
|
||||
v.push_back(std::to_string(e.cast_time));
|
||||
|
||||
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_AURAS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_BASE_DATA_REPOSITORY_H
|
||||
@@ -140,8 +140,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
base_data_id
|
||||
)
|
||||
);
|
||||
@@ -150,16 +151,16 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
BaseData e{};
|
||||
|
||||
e.level = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.class_ = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.hp = strtod(row[2], nullptr);
|
||||
e.mana = strtod(row[3], nullptr);
|
||||
e.end = strtod(row[4], nullptr);
|
||||
e.unk1 = strtod(row[5], nullptr);
|
||||
e.unk2 = strtod(row[6], nullptr);
|
||||
e.hp_fac = strtod(row[7], nullptr);
|
||||
e.mana_fac = strtod(row[8], nullptr);
|
||||
e.end_fac = strtod(row[9], nullptr);
|
||||
e.level = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.class_ = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.hp = row[2] ? strtod(row[2], nullptr) : 0;
|
||||
e.mana = row[3] ? strtod(row[3], nullptr) : 0;
|
||||
e.end = row[4] ? strtod(row[4], nullptr) : 0;
|
||||
e.unk1 = row[5] ? strtod(row[5], nullptr) : 0;
|
||||
e.unk2 = row[6] ? strtod(row[6], nullptr) : 0;
|
||||
e.hp_fac = row[7] ? strtod(row[7], nullptr) : 0;
|
||||
e.mana_fac = row[8] ? strtod(row[8], nullptr) : 0;
|
||||
e.end_fac = row[9] ? strtod(row[9], nullptr) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -306,16 +307,16 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
BaseData e{};
|
||||
|
||||
e.level = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.class_ = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.hp = strtod(row[2], nullptr);
|
||||
e.mana = strtod(row[3], nullptr);
|
||||
e.end = strtod(row[4], nullptr);
|
||||
e.unk1 = strtod(row[5], nullptr);
|
||||
e.unk2 = strtod(row[6], nullptr);
|
||||
e.hp_fac = strtod(row[7], nullptr);
|
||||
e.mana_fac = strtod(row[8], nullptr);
|
||||
e.end_fac = strtod(row[9], nullptr);
|
||||
e.level = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.class_ = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.hp = row[2] ? strtod(row[2], nullptr) : 0;
|
||||
e.mana = row[3] ? strtod(row[3], nullptr) : 0;
|
||||
e.end = row[4] ? strtod(row[4], nullptr) : 0;
|
||||
e.unk1 = row[5] ? strtod(row[5], nullptr) : 0;
|
||||
e.unk2 = row[6] ? strtod(row[6], nullptr) : 0;
|
||||
e.hp_fac = row[7] ? strtod(row[7], nullptr) : 0;
|
||||
e.mana_fac = row[8] ? strtod(row[8], nullptr) : 0;
|
||||
e.end_fac = row[9] ? strtod(row[9], nullptr) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -340,16 +341,16 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
BaseData e{};
|
||||
|
||||
e.level = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.class_ = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.hp = strtod(row[2], nullptr);
|
||||
e.mana = strtod(row[3], nullptr);
|
||||
e.end = strtod(row[4], nullptr);
|
||||
e.unk1 = strtod(row[5], nullptr);
|
||||
e.unk2 = strtod(row[6], nullptr);
|
||||
e.hp_fac = strtod(row[7], nullptr);
|
||||
e.mana_fac = strtod(row[8], nullptr);
|
||||
e.end_fac = strtod(row[9], nullptr);
|
||||
e.level = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.class_ = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.hp = row[2] ? strtod(row[2], nullptr) : 0;
|
||||
e.mana = row[3] ? strtod(row[3], nullptr) : 0;
|
||||
e.end = row[4] ? strtod(row[4], nullptr) : 0;
|
||||
e.unk1 = row[5] ? strtod(row[5], nullptr) : 0;
|
||||
e.unk2 = row[6] ? strtod(row[6], nullptr) : 0;
|
||||
e.hp_fac = row[7] ? strtod(row[7], nullptr) : 0;
|
||||
e.mana_fac = row[8] ? strtod(row[8], nullptr) : 0;
|
||||
e.end_fac = row[9] ? strtod(row[9], nullptr) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -408,6 +409,80 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const BaseData &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.level));
|
||||
v.push_back(std::to_string(e.class_));
|
||||
v.push_back(std::to_string(e.hp));
|
||||
v.push_back(std::to_string(e.mana));
|
||||
v.push_back(std::to_string(e.end));
|
||||
v.push_back(std::to_string(e.unk1));
|
||||
v.push_back(std::to_string(e.unk2));
|
||||
v.push_back(std::to_string(e.hp_fac));
|
||||
v.push_back(std::to_string(e.mana_fac));
|
||||
v.push_back(std::to_string(e.end_fac));
|
||||
|
||||
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<BaseData> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.level));
|
||||
v.push_back(std::to_string(e.class_));
|
||||
v.push_back(std::to_string(e.hp));
|
||||
v.push_back(std::to_string(e.mana));
|
||||
v.push_back(std::to_string(e.end));
|
||||
v.push_back(std::to_string(e.unk1));
|
||||
v.push_back(std::to_string(e.unk2));
|
||||
v.push_back(std::to_string(e.hp_fac));
|
||||
v.push_back(std::to_string(e.mana_fac));
|
||||
v.push_back(std::to_string(e.end_fac));
|
||||
|
||||
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_BASE_DATA_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_BLOCKED_SPELLS_REPOSITORY_H
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
class BaseBlockedSpellsRepository {
|
||||
public:
|
||||
struct BlockedSpells {
|
||||
@@ -176,20 +175,20 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
BlockedSpells e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.spellid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.type = static_cast<int8_t>(atoi(row[2]));
|
||||
e.zoneid = static_cast<int32_t>(atoi(row[3]));
|
||||
e.x = strtof(row[4], nullptr);
|
||||
e.y = strtof(row[5], nullptr);
|
||||
e.z = strtof(row[6], nullptr);
|
||||
e.x_diff = strtof(row[7], nullptr);
|
||||
e.y_diff = strtof(row[8], nullptr);
|
||||
e.z_diff = strtof(row[9], nullptr);
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.spellid = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.type = row[2] ? static_cast<int8_t>(atoi(row[2])) : 0;
|
||||
e.zoneid = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
e.x = row[4] ? strtof(row[4], nullptr) : 0;
|
||||
e.y = row[5] ? strtof(row[5], nullptr) : 0;
|
||||
e.z = row[6] ? strtof(row[6], nullptr) : 0;
|
||||
e.x_diff = row[7] ? strtof(row[7], nullptr) : 0;
|
||||
e.y_diff = row[8] ? strtof(row[8], nullptr) : 0;
|
||||
e.z_diff = row[9] ? strtof(row[9], nullptr) : 0;
|
||||
e.message = row[10] ? row[10] : "";
|
||||
e.description = row[11] ? row[11] : "";
|
||||
e.min_expansion = static_cast<int8_t>(atoi(row[12]));
|
||||
e.max_expansion = static_cast<int8_t>(atoi(row[13]));
|
||||
e.min_expansion = row[12] ? static_cast<int8_t>(atoi(row[12])) : -1;
|
||||
e.max_expansion = row[13] ? static_cast<int8_t>(atoi(row[13])) : -1;
|
||||
e.content_flags = row[14] ? row[14] : "";
|
||||
e.content_flags_disabled = row[15] ? row[15] : "";
|
||||
|
||||
@@ -355,20 +354,20 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
BlockedSpells e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.spellid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.type = static_cast<int8_t>(atoi(row[2]));
|
||||
e.zoneid = static_cast<int32_t>(atoi(row[3]));
|
||||
e.x = strtof(row[4], nullptr);
|
||||
e.y = strtof(row[5], nullptr);
|
||||
e.z = strtof(row[6], nullptr);
|
||||
e.x_diff = strtof(row[7], nullptr);
|
||||
e.y_diff = strtof(row[8], nullptr);
|
||||
e.z_diff = strtof(row[9], nullptr);
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.spellid = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.type = row[2] ? static_cast<int8_t>(atoi(row[2])) : 0;
|
||||
e.zoneid = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
e.x = row[4] ? strtof(row[4], nullptr) : 0;
|
||||
e.y = row[5] ? strtof(row[5], nullptr) : 0;
|
||||
e.z = row[6] ? strtof(row[6], nullptr) : 0;
|
||||
e.x_diff = row[7] ? strtof(row[7], nullptr) : 0;
|
||||
e.y_diff = row[8] ? strtof(row[8], nullptr) : 0;
|
||||
e.z_diff = row[9] ? strtof(row[9], nullptr) : 0;
|
||||
e.message = row[10] ? row[10] : "";
|
||||
e.description = row[11] ? row[11] : "";
|
||||
e.min_expansion = static_cast<int8_t>(atoi(row[12]));
|
||||
e.max_expansion = static_cast<int8_t>(atoi(row[13]));
|
||||
e.min_expansion = row[12] ? static_cast<int8_t>(atoi(row[12])) : -1;
|
||||
e.max_expansion = row[13] ? static_cast<int8_t>(atoi(row[13])) : -1;
|
||||
e.content_flags = row[14] ? row[14] : "";
|
||||
e.content_flags_disabled = row[15] ? row[15] : "";
|
||||
|
||||
@@ -395,20 +394,20 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
BlockedSpells e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.spellid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.type = static_cast<int8_t>(atoi(row[2]));
|
||||
e.zoneid = static_cast<int32_t>(atoi(row[3]));
|
||||
e.x = strtof(row[4], nullptr);
|
||||
e.y = strtof(row[5], nullptr);
|
||||
e.z = strtof(row[6], nullptr);
|
||||
e.x_diff = strtof(row[7], nullptr);
|
||||
e.y_diff = strtof(row[8], nullptr);
|
||||
e.z_diff = strtof(row[9], nullptr);
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.spellid = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.type = row[2] ? static_cast<int8_t>(atoi(row[2])) : 0;
|
||||
e.zoneid = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
e.x = row[4] ? strtof(row[4], nullptr) : 0;
|
||||
e.y = row[5] ? strtof(row[5], nullptr) : 0;
|
||||
e.z = row[6] ? strtof(row[6], nullptr) : 0;
|
||||
e.x_diff = row[7] ? strtof(row[7], nullptr) : 0;
|
||||
e.y_diff = row[8] ? strtof(row[8], nullptr) : 0;
|
||||
e.z_diff = row[9] ? strtof(row[9], nullptr) : 0;
|
||||
e.message = row[10] ? row[10] : "";
|
||||
e.description = row[11] ? row[11] : "";
|
||||
e.min_expansion = static_cast<int8_t>(atoi(row[12]));
|
||||
e.max_expansion = static_cast<int8_t>(atoi(row[13]));
|
||||
e.min_expansion = row[12] ? static_cast<int8_t>(atoi(row[12])) : -1;
|
||||
e.max_expansion = row[13] ? static_cast<int8_t>(atoi(row[13])) : -1;
|
||||
e.content_flags = row[14] ? row[14] : "";
|
||||
e.content_flags_disabled = row[15] ? row[15] : "";
|
||||
|
||||
@@ -469,6 +468,92 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const BlockedSpells &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.spellid));
|
||||
v.push_back(std::to_string(e.type));
|
||||
v.push_back(std::to_string(e.zoneid));
|
||||
v.push_back(std::to_string(e.x));
|
||||
v.push_back(std::to_string(e.y));
|
||||
v.push_back(std::to_string(e.z));
|
||||
v.push_back(std::to_string(e.x_diff));
|
||||
v.push_back(std::to_string(e.y_diff));
|
||||
v.push_back(std::to_string(e.z_diff));
|
||||
v.push_back("'" + Strings::Escape(e.message) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.description) + "'");
|
||||
v.push_back(std::to_string(e.min_expansion));
|
||||
v.push_back(std::to_string(e.max_expansion));
|
||||
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.content_flags_disabled) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int ReplaceMany(
|
||||
Database& db,
|
||||
const std::vector<BlockedSpells> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.spellid));
|
||||
v.push_back(std::to_string(e.type));
|
||||
v.push_back(std::to_string(e.zoneid));
|
||||
v.push_back(std::to_string(e.x));
|
||||
v.push_back(std::to_string(e.y));
|
||||
v.push_back(std::to_string(e.z));
|
||||
v.push_back(std::to_string(e.x_diff));
|
||||
v.push_back(std::to_string(e.y_diff));
|
||||
v.push_back(std::to_string(e.z_diff));
|
||||
v.push_back("'" + Strings::Escape(e.message) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.description) + "'");
|
||||
v.push_back(std::to_string(e.min_expansion));
|
||||
v.push_back(std::to_string(e.max_expansion));
|
||||
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.content_flags_disabled) + "'");
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_BLOCKED_SPELLS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_BOOKS_REPOSITORY_H
|
||||
@@ -116,8 +116,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
books_id
|
||||
)
|
||||
);
|
||||
@@ -126,10 +127,10 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
Books e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.txtfile = row[2] ? row[2] : "";
|
||||
e.language = static_cast<int32_t>(atoi(row[3]));
|
||||
e.language = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -257,10 +258,10 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
Books e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.txtfile = row[2] ? row[2] : "";
|
||||
e.language = static_cast<int32_t>(atoi(row[3]));
|
||||
e.language = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -285,10 +286,10 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
Books e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.txtfile = row[2] ? row[2] : "";
|
||||
e.language = static_cast<int32_t>(atoi(row[3]));
|
||||
e.language = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -347,6 +348,68 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const Books &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.txtfile) + "'");
|
||||
v.push_back(std::to_string(e.language));
|
||||
|
||||
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<Books> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.txtfile) + "'");
|
||||
v.push_back(std::to_string(e.language));
|
||||
|
||||
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_BOOKS_REPOSITORY_H
|
||||
|
||||
@@ -16,12 +16,19 @@
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
class BaseBotTimersRepository {
|
||||
public:
|
||||
struct BotTimers {
|
||||
uint32_t bot_id;
|
||||
uint32_t timer_id;
|
||||
uint32_t timer_value;
|
||||
uint32_t recast_time;
|
||||
uint8_t is_spell;
|
||||
uint8_t is_disc;
|
||||
uint32_t spell_id;
|
||||
uint8_t is_item;
|
||||
uint32_t item_id;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
@@ -35,6 +42,12 @@ public:
|
||||
"bot_id",
|
||||
"timer_id",
|
||||
"timer_value",
|
||||
"recast_time",
|
||||
"is_spell",
|
||||
"is_disc",
|
||||
"spell_id",
|
||||
"is_item",
|
||||
"item_id",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -44,6 +57,12 @@ public:
|
||||
"bot_id",
|
||||
"timer_id",
|
||||
"timer_value",
|
||||
"recast_time",
|
||||
"is_spell",
|
||||
"is_disc",
|
||||
"spell_id",
|
||||
"is_item",
|
||||
"item_id",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -87,6 +106,12 @@ public:
|
||||
e.bot_id = 0;
|
||||
e.timer_id = 0;
|
||||
e.timer_value = 0;
|
||||
e.recast_time = 0;
|
||||
e.is_spell = 0;
|
||||
e.is_disc = 0;
|
||||
e.spell_id = 0;
|
||||
e.is_item = 0;
|
||||
e.item_id = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -112,8 +137,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
bot_timers_id
|
||||
)
|
||||
);
|
||||
@@ -125,6 +151,12 @@ public:
|
||||
e.bot_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.timer_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.timer_value = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.recast_time = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.is_spell = static_cast<uint8_t>(strtoul(row[4], nullptr, 10));
|
||||
e.is_disc = static_cast<uint8_t>(strtoul(row[5], nullptr, 10));
|
||||
e.spell_id = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.is_item = static_cast<uint8_t>(strtoul(row[7], nullptr, 10));
|
||||
e.item_id = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -161,6 +193,12 @@ public:
|
||||
v.push_back(columns[0] + " = " + std::to_string(e.bot_id));
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.timer_id));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.timer_value));
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.recast_time));
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.is_spell));
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.is_disc));
|
||||
v.push_back(columns[6] + " = " + std::to_string(e.spell_id));
|
||||
v.push_back(columns[7] + " = " + std::to_string(e.is_item));
|
||||
v.push_back(columns[8] + " = " + std::to_string(e.item_id));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -185,6 +223,12 @@ public:
|
||||
v.push_back(std::to_string(e.bot_id));
|
||||
v.push_back(std::to_string(e.timer_id));
|
||||
v.push_back(std::to_string(e.timer_value));
|
||||
v.push_back(std::to_string(e.recast_time));
|
||||
v.push_back(std::to_string(e.is_spell));
|
||||
v.push_back(std::to_string(e.is_disc));
|
||||
v.push_back(std::to_string(e.spell_id));
|
||||
v.push_back(std::to_string(e.is_item));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -217,6 +261,12 @@ public:
|
||||
v.push_back(std::to_string(e.bot_id));
|
||||
v.push_back(std::to_string(e.timer_id));
|
||||
v.push_back(std::to_string(e.timer_value));
|
||||
v.push_back(std::to_string(e.recast_time));
|
||||
v.push_back(std::to_string(e.is_spell));
|
||||
v.push_back(std::to_string(e.is_disc));
|
||||
v.push_back(std::to_string(e.spell_id));
|
||||
v.push_back(std::to_string(e.is_item));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
@@ -253,6 +303,12 @@ public:
|
||||
e.bot_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.timer_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.timer_value = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.recast_time = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.is_spell = static_cast<uint8_t>(strtoul(row[4], nullptr, 10));
|
||||
e.is_disc = static_cast<uint8_t>(strtoul(row[5], nullptr, 10));
|
||||
e.spell_id = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.is_item = static_cast<uint8_t>(strtoul(row[7], nullptr, 10));
|
||||
e.item_id = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -280,6 +336,12 @@ public:
|
||||
e.bot_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.timer_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.timer_value = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.recast_time = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.is_spell = static_cast<uint8_t>(strtoul(row[4], nullptr, 10));
|
||||
e.is_disc = static_cast<uint8_t>(strtoul(row[5], nullptr, 10));
|
||||
e.spell_id = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.is_item = static_cast<uint8_t>(strtoul(row[7], nullptr, 10));
|
||||
e.item_id = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_BUG_REPORTS_REPOSITORY_H
|
||||
@@ -228,8 +228,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
bug_reports_id
|
||||
)
|
||||
);
|
||||
@@ -238,37 +239,37 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
BugReports e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.zone = row[1] ? row[1] : "";
|
||||
e.client_version_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.client_version_name = row[3] ? row[3] : "";
|
||||
e.account_id = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.character_id = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.character_name = row[6] ? row[6] : "";
|
||||
e.reporter_spoof = static_cast<int8_t>(atoi(row[7]));
|
||||
e.category_id = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.category_name = row[9] ? row[9] : "";
|
||||
e.reporter_name = row[10] ? row[10] : "";
|
||||
e.ui_path = row[11] ? row[11] : "";
|
||||
e.pos_x = strtof(row[12], nullptr);
|
||||
e.pos_y = strtof(row[13], nullptr);
|
||||
e.pos_z = strtof(row[14], nullptr);
|
||||
e.heading = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
||||
e.time_played = static_cast<uint32_t>(strtoul(row[16], nullptr, 10));
|
||||
e.target_id = static_cast<uint32_t>(strtoul(row[17], nullptr, 10));
|
||||
e.target_name = row[18] ? row[18] : "";
|
||||
e.optional_info_mask = static_cast<uint32_t>(strtoul(row[19], nullptr, 10));
|
||||
e._can_duplicate = static_cast<int8_t>(atoi(row[20]));
|
||||
e._crash_bug = static_cast<int8_t>(atoi(row[21]));
|
||||
e._target_info = static_cast<int8_t>(atoi(row[22]));
|
||||
e._character_flags = static_cast<int8_t>(atoi(row[23]));
|
||||
e._unknown_value = static_cast<int8_t>(atoi(row[24]));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.zone = row[1] ? row[1] : "Unknown";
|
||||
e.client_version_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.client_version_name = row[3] ? row[3] : "Unknown";
|
||||
e.account_id = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.character_id = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.character_name = row[6] ? row[6] : "Unknown";
|
||||
e.reporter_spoof = row[7] ? static_cast<int8_t>(atoi(row[7])) : 1;
|
||||
e.category_id = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.category_name = row[9] ? row[9] : "Other";
|
||||
e.reporter_name = row[10] ? row[10] : "Unknown";
|
||||
e.ui_path = row[11] ? row[11] : "Unknown";
|
||||
e.pos_x = row[12] ? strtof(row[12], nullptr) : 0;
|
||||
e.pos_y = row[13] ? strtof(row[13], nullptr) : 0;
|
||||
e.pos_z = row[14] ? strtof(row[14], nullptr) : 0;
|
||||
e.heading = row[15] ? static_cast<uint32_t>(strtoul(row[15], nullptr, 10)) : 0;
|
||||
e.time_played = row[16] ? static_cast<uint32_t>(strtoul(row[16], nullptr, 10)) : 0;
|
||||
e.target_id = row[17] ? static_cast<uint32_t>(strtoul(row[17], nullptr, 10)) : 0;
|
||||
e.target_name = row[18] ? row[18] : "Unknown";
|
||||
e.optional_info_mask = row[19] ? static_cast<uint32_t>(strtoul(row[19], nullptr, 10)) : 0;
|
||||
e._can_duplicate = row[20] ? static_cast<int8_t>(atoi(row[20])) : 0;
|
||||
e._crash_bug = row[21] ? static_cast<int8_t>(atoi(row[21])) : 0;
|
||||
e._target_info = row[22] ? static_cast<int8_t>(atoi(row[22])) : 0;
|
||||
e._character_flags = row[23] ? static_cast<int8_t>(atoi(row[23])) : 0;
|
||||
e._unknown_value = row[24] ? static_cast<int8_t>(atoi(row[24])) : 0;
|
||||
e.bug_report = row[25] ? row[25] : "";
|
||||
e.system_info = row[26] ? row[26] : "";
|
||||
e.report_datetime = strtoll(row[27] ? row[27] : "-1", nullptr, 10);
|
||||
e.bug_status = static_cast<uint8_t>(strtoul(row[28], nullptr, 10));
|
||||
e.bug_status = row[28] ? static_cast<uint8_t>(strtoul(row[28], nullptr, 10)) : 0;
|
||||
e.last_review = strtoll(row[29] ? row[29] : "-1", nullptr, 10);
|
||||
e.last_reviewer = row[30] ? row[30] : "";
|
||||
e.last_reviewer = row[30] ? row[30] : "None";
|
||||
e.reviewer_notes = row[31] ? row[31] : "";
|
||||
|
||||
return e;
|
||||
@@ -481,37 +482,37 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
BugReports e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.zone = row[1] ? row[1] : "";
|
||||
e.client_version_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.client_version_name = row[3] ? row[3] : "";
|
||||
e.account_id = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.character_id = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.character_name = row[6] ? row[6] : "";
|
||||
e.reporter_spoof = static_cast<int8_t>(atoi(row[7]));
|
||||
e.category_id = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.category_name = row[9] ? row[9] : "";
|
||||
e.reporter_name = row[10] ? row[10] : "";
|
||||
e.ui_path = row[11] ? row[11] : "";
|
||||
e.pos_x = strtof(row[12], nullptr);
|
||||
e.pos_y = strtof(row[13], nullptr);
|
||||
e.pos_z = strtof(row[14], nullptr);
|
||||
e.heading = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
||||
e.time_played = static_cast<uint32_t>(strtoul(row[16], nullptr, 10));
|
||||
e.target_id = static_cast<uint32_t>(strtoul(row[17], nullptr, 10));
|
||||
e.target_name = row[18] ? row[18] : "";
|
||||
e.optional_info_mask = static_cast<uint32_t>(strtoul(row[19], nullptr, 10));
|
||||
e._can_duplicate = static_cast<int8_t>(atoi(row[20]));
|
||||
e._crash_bug = static_cast<int8_t>(atoi(row[21]));
|
||||
e._target_info = static_cast<int8_t>(atoi(row[22]));
|
||||
e._character_flags = static_cast<int8_t>(atoi(row[23]));
|
||||
e._unknown_value = static_cast<int8_t>(atoi(row[24]));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.zone = row[1] ? row[1] : "Unknown";
|
||||
e.client_version_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.client_version_name = row[3] ? row[3] : "Unknown";
|
||||
e.account_id = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.character_id = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.character_name = row[6] ? row[6] : "Unknown";
|
||||
e.reporter_spoof = row[7] ? static_cast<int8_t>(atoi(row[7])) : 1;
|
||||
e.category_id = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.category_name = row[9] ? row[9] : "Other";
|
||||
e.reporter_name = row[10] ? row[10] : "Unknown";
|
||||
e.ui_path = row[11] ? row[11] : "Unknown";
|
||||
e.pos_x = row[12] ? strtof(row[12], nullptr) : 0;
|
||||
e.pos_y = row[13] ? strtof(row[13], nullptr) : 0;
|
||||
e.pos_z = row[14] ? strtof(row[14], nullptr) : 0;
|
||||
e.heading = row[15] ? static_cast<uint32_t>(strtoul(row[15], nullptr, 10)) : 0;
|
||||
e.time_played = row[16] ? static_cast<uint32_t>(strtoul(row[16], nullptr, 10)) : 0;
|
||||
e.target_id = row[17] ? static_cast<uint32_t>(strtoul(row[17], nullptr, 10)) : 0;
|
||||
e.target_name = row[18] ? row[18] : "Unknown";
|
||||
e.optional_info_mask = row[19] ? static_cast<uint32_t>(strtoul(row[19], nullptr, 10)) : 0;
|
||||
e._can_duplicate = row[20] ? static_cast<int8_t>(atoi(row[20])) : 0;
|
||||
e._crash_bug = row[21] ? static_cast<int8_t>(atoi(row[21])) : 0;
|
||||
e._target_info = row[22] ? static_cast<int8_t>(atoi(row[22])) : 0;
|
||||
e._character_flags = row[23] ? static_cast<int8_t>(atoi(row[23])) : 0;
|
||||
e._unknown_value = row[24] ? static_cast<int8_t>(atoi(row[24])) : 0;
|
||||
e.bug_report = row[25] ? row[25] : "";
|
||||
e.system_info = row[26] ? row[26] : "";
|
||||
e.report_datetime = strtoll(row[27] ? row[27] : "-1", nullptr, 10);
|
||||
e.bug_status = static_cast<uint8_t>(strtoul(row[28], nullptr, 10));
|
||||
e.bug_status = row[28] ? static_cast<uint8_t>(strtoul(row[28], nullptr, 10)) : 0;
|
||||
e.last_review = strtoll(row[29] ? row[29] : "-1", nullptr, 10);
|
||||
e.last_reviewer = row[30] ? row[30] : "";
|
||||
e.last_reviewer = row[30] ? row[30] : "None";
|
||||
e.reviewer_notes = row[31] ? row[31] : "";
|
||||
|
||||
all_entries.push_back(e);
|
||||
@@ -537,37 +538,37 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
BugReports e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.zone = row[1] ? row[1] : "";
|
||||
e.client_version_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.client_version_name = row[3] ? row[3] : "";
|
||||
e.account_id = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.character_id = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.character_name = row[6] ? row[6] : "";
|
||||
e.reporter_spoof = static_cast<int8_t>(atoi(row[7]));
|
||||
e.category_id = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.category_name = row[9] ? row[9] : "";
|
||||
e.reporter_name = row[10] ? row[10] : "";
|
||||
e.ui_path = row[11] ? row[11] : "";
|
||||
e.pos_x = strtof(row[12], nullptr);
|
||||
e.pos_y = strtof(row[13], nullptr);
|
||||
e.pos_z = strtof(row[14], nullptr);
|
||||
e.heading = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
||||
e.time_played = static_cast<uint32_t>(strtoul(row[16], nullptr, 10));
|
||||
e.target_id = static_cast<uint32_t>(strtoul(row[17], nullptr, 10));
|
||||
e.target_name = row[18] ? row[18] : "";
|
||||
e.optional_info_mask = static_cast<uint32_t>(strtoul(row[19], nullptr, 10));
|
||||
e._can_duplicate = static_cast<int8_t>(atoi(row[20]));
|
||||
e._crash_bug = static_cast<int8_t>(atoi(row[21]));
|
||||
e._target_info = static_cast<int8_t>(atoi(row[22]));
|
||||
e._character_flags = static_cast<int8_t>(atoi(row[23]));
|
||||
e._unknown_value = static_cast<int8_t>(atoi(row[24]));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.zone = row[1] ? row[1] : "Unknown";
|
||||
e.client_version_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.client_version_name = row[3] ? row[3] : "Unknown";
|
||||
e.account_id = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.character_id = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.character_name = row[6] ? row[6] : "Unknown";
|
||||
e.reporter_spoof = row[7] ? static_cast<int8_t>(atoi(row[7])) : 1;
|
||||
e.category_id = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.category_name = row[9] ? row[9] : "Other";
|
||||
e.reporter_name = row[10] ? row[10] : "Unknown";
|
||||
e.ui_path = row[11] ? row[11] : "Unknown";
|
||||
e.pos_x = row[12] ? strtof(row[12], nullptr) : 0;
|
||||
e.pos_y = row[13] ? strtof(row[13], nullptr) : 0;
|
||||
e.pos_z = row[14] ? strtof(row[14], nullptr) : 0;
|
||||
e.heading = row[15] ? static_cast<uint32_t>(strtoul(row[15], nullptr, 10)) : 0;
|
||||
e.time_played = row[16] ? static_cast<uint32_t>(strtoul(row[16], nullptr, 10)) : 0;
|
||||
e.target_id = row[17] ? static_cast<uint32_t>(strtoul(row[17], nullptr, 10)) : 0;
|
||||
e.target_name = row[18] ? row[18] : "Unknown";
|
||||
e.optional_info_mask = row[19] ? static_cast<uint32_t>(strtoul(row[19], nullptr, 10)) : 0;
|
||||
e._can_duplicate = row[20] ? static_cast<int8_t>(atoi(row[20])) : 0;
|
||||
e._crash_bug = row[21] ? static_cast<int8_t>(atoi(row[21])) : 0;
|
||||
e._target_info = row[22] ? static_cast<int8_t>(atoi(row[22])) : 0;
|
||||
e._character_flags = row[23] ? static_cast<int8_t>(atoi(row[23])) : 0;
|
||||
e._unknown_value = row[24] ? static_cast<int8_t>(atoi(row[24])) : 0;
|
||||
e.bug_report = row[25] ? row[25] : "";
|
||||
e.system_info = row[26] ? row[26] : "";
|
||||
e.report_datetime = strtoll(row[27] ? row[27] : "-1", nullptr, 10);
|
||||
e.bug_status = static_cast<uint8_t>(strtoul(row[28], nullptr, 10));
|
||||
e.bug_status = row[28] ? static_cast<uint8_t>(strtoul(row[28], nullptr, 10)) : 0;
|
||||
e.last_review = strtoll(row[29] ? row[29] : "-1", nullptr, 10);
|
||||
e.last_reviewer = row[30] ? row[30] : "";
|
||||
e.last_reviewer = row[30] ? row[30] : "None";
|
||||
e.reviewer_notes = row[31] ? row[31] : "";
|
||||
|
||||
all_entries.push_back(e);
|
||||
@@ -627,6 +628,124 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const BugReports &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back("'" + Strings::Escape(e.zone) + "'");
|
||||
v.push_back(std::to_string(e.client_version_id));
|
||||
v.push_back("'" + Strings::Escape(e.client_version_name) + "'");
|
||||
v.push_back(std::to_string(e.account_id));
|
||||
v.push_back(std::to_string(e.character_id));
|
||||
v.push_back("'" + Strings::Escape(e.character_name) + "'");
|
||||
v.push_back(std::to_string(e.reporter_spoof));
|
||||
v.push_back(std::to_string(e.category_id));
|
||||
v.push_back("'" + Strings::Escape(e.category_name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.reporter_name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.ui_path) + "'");
|
||||
v.push_back(std::to_string(e.pos_x));
|
||||
v.push_back(std::to_string(e.pos_y));
|
||||
v.push_back(std::to_string(e.pos_z));
|
||||
v.push_back(std::to_string(e.heading));
|
||||
v.push_back(std::to_string(e.time_played));
|
||||
v.push_back(std::to_string(e.target_id));
|
||||
v.push_back("'" + Strings::Escape(e.target_name) + "'");
|
||||
v.push_back(std::to_string(e.optional_info_mask));
|
||||
v.push_back(std::to_string(e._can_duplicate));
|
||||
v.push_back(std::to_string(e._crash_bug));
|
||||
v.push_back(std::to_string(e._target_info));
|
||||
v.push_back(std::to_string(e._character_flags));
|
||||
v.push_back(std::to_string(e._unknown_value));
|
||||
v.push_back("'" + Strings::Escape(e.bug_report) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.system_info) + "'");
|
||||
v.push_back("FROM_UNIXTIME(" + (e.report_datetime > 0 ? std::to_string(e.report_datetime) : "null") + ")");
|
||||
v.push_back(std::to_string(e.bug_status));
|
||||
v.push_back("FROM_UNIXTIME(" + (e.last_review > 0 ? std::to_string(e.last_review) : "null") + ")");
|
||||
v.push_back("'" + Strings::Escape(e.last_reviewer) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.reviewer_notes) + "'");
|
||||
|
||||
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<BugReports> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back("'" + Strings::Escape(e.zone) + "'");
|
||||
v.push_back(std::to_string(e.client_version_id));
|
||||
v.push_back("'" + Strings::Escape(e.client_version_name) + "'");
|
||||
v.push_back(std::to_string(e.account_id));
|
||||
v.push_back(std::to_string(e.character_id));
|
||||
v.push_back("'" + Strings::Escape(e.character_name) + "'");
|
||||
v.push_back(std::to_string(e.reporter_spoof));
|
||||
v.push_back(std::to_string(e.category_id));
|
||||
v.push_back("'" + Strings::Escape(e.category_name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.reporter_name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.ui_path) + "'");
|
||||
v.push_back(std::to_string(e.pos_x));
|
||||
v.push_back(std::to_string(e.pos_y));
|
||||
v.push_back(std::to_string(e.pos_z));
|
||||
v.push_back(std::to_string(e.heading));
|
||||
v.push_back(std::to_string(e.time_played));
|
||||
v.push_back(std::to_string(e.target_id));
|
||||
v.push_back("'" + Strings::Escape(e.target_name) + "'");
|
||||
v.push_back(std::to_string(e.optional_info_mask));
|
||||
v.push_back(std::to_string(e._can_duplicate));
|
||||
v.push_back(std::to_string(e._crash_bug));
|
||||
v.push_back(std::to_string(e._target_info));
|
||||
v.push_back(std::to_string(e._character_flags));
|
||||
v.push_back(std::to_string(e._unknown_value));
|
||||
v.push_back("'" + Strings::Escape(e.bug_report) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.system_info) + "'");
|
||||
v.push_back("FROM_UNIXTIME(" + (e.report_datetime > 0 ? std::to_string(e.report_datetime) : "null") + ")");
|
||||
v.push_back(std::to_string(e.bug_status));
|
||||
v.push_back("FROM_UNIXTIME(" + (e.last_review > 0 ? std::to_string(e.last_review) : "null") + ")");
|
||||
v.push_back("'" + Strings::Escape(e.last_reviewer) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.reviewer_notes) + "'");
|
||||
|
||||
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_BUG_REPORTS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_BUGS_REPOSITORY_H
|
||||
@@ -152,8 +152,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
bugs_id
|
||||
)
|
||||
);
|
||||
@@ -162,19 +163,19 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
Bugs e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.zone = row[1] ? row[1] : "";
|
||||
e.name = row[2] ? row[2] : "";
|
||||
e.ui = row[3] ? row[3] : "";
|
||||
e.x = strtof(row[4], nullptr);
|
||||
e.y = strtof(row[5], nullptr);
|
||||
e.z = strtof(row[6], nullptr);
|
||||
e.x = row[4] ? strtof(row[4], nullptr) : 0;
|
||||
e.y = row[5] ? strtof(row[5], nullptr) : 0;
|
||||
e.z = row[6] ? strtof(row[6], nullptr) : 0;
|
||||
e.type = row[7] ? row[7] : "";
|
||||
e.flag = static_cast<uint8_t>(strtoul(row[8], nullptr, 10));
|
||||
e.flag = row[8] ? static_cast<uint8_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.target = row[9] ? row[9] : "";
|
||||
e.bug = row[10] ? row[10] : "";
|
||||
e.date = row[11] ? row[11] : "";
|
||||
e.status = static_cast<uint8_t>(strtoul(row[12], nullptr, 10));
|
||||
e.date = row[11] ? row[11] : 0;
|
||||
e.status = row[12] ? static_cast<uint8_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -329,19 +330,19 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
Bugs e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.zone = row[1] ? row[1] : "";
|
||||
e.name = row[2] ? row[2] : "";
|
||||
e.ui = row[3] ? row[3] : "";
|
||||
e.x = strtof(row[4], nullptr);
|
||||
e.y = strtof(row[5], nullptr);
|
||||
e.z = strtof(row[6], nullptr);
|
||||
e.x = row[4] ? strtof(row[4], nullptr) : 0;
|
||||
e.y = row[5] ? strtof(row[5], nullptr) : 0;
|
||||
e.z = row[6] ? strtof(row[6], nullptr) : 0;
|
||||
e.type = row[7] ? row[7] : "";
|
||||
e.flag = static_cast<uint8_t>(strtoul(row[8], nullptr, 10));
|
||||
e.flag = row[8] ? static_cast<uint8_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.target = row[9] ? row[9] : "";
|
||||
e.bug = row[10] ? row[10] : "";
|
||||
e.date = row[11] ? row[11] : "";
|
||||
e.status = static_cast<uint8_t>(strtoul(row[12], nullptr, 10));
|
||||
e.date = row[11] ? row[11] : 0;
|
||||
e.status = row[12] ? static_cast<uint8_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -366,19 +367,19 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
Bugs e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.zone = row[1] ? row[1] : "";
|
||||
e.name = row[2] ? row[2] : "";
|
||||
e.ui = row[3] ? row[3] : "";
|
||||
e.x = strtof(row[4], nullptr);
|
||||
e.y = strtof(row[5], nullptr);
|
||||
e.z = strtof(row[6], nullptr);
|
||||
e.x = row[4] ? strtof(row[4], nullptr) : 0;
|
||||
e.y = row[5] ? strtof(row[5], nullptr) : 0;
|
||||
e.z = row[6] ? strtof(row[6], nullptr) : 0;
|
||||
e.type = row[7] ? row[7] : "";
|
||||
e.flag = static_cast<uint8_t>(strtoul(row[8], nullptr, 10));
|
||||
e.flag = row[8] ? static_cast<uint8_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.target = row[9] ? row[9] : "";
|
||||
e.bug = row[10] ? row[10] : "";
|
||||
e.date = row[11] ? row[11] : "";
|
||||
e.status = static_cast<uint8_t>(strtoul(row[12], nullptr, 10));
|
||||
e.date = row[11] ? row[11] : 0;
|
||||
e.status = row[12] ? static_cast<uint8_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -437,6 +438,86 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const Bugs &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back("'" + Strings::Escape(e.zone) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.ui) + "'");
|
||||
v.push_back(std::to_string(e.x));
|
||||
v.push_back(std::to_string(e.y));
|
||||
v.push_back(std::to_string(e.z));
|
||||
v.push_back("'" + Strings::Escape(e.type) + "'");
|
||||
v.push_back(std::to_string(e.flag));
|
||||
v.push_back("'" + Strings::Escape(e.target) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.bug) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.date) + "'");
|
||||
v.push_back(std::to_string(e.status));
|
||||
|
||||
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<Bugs> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back("'" + Strings::Escape(e.zone) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.ui) + "'");
|
||||
v.push_back(std::to_string(e.x));
|
||||
v.push_back(std::to_string(e.y));
|
||||
v.push_back(std::to_string(e.z));
|
||||
v.push_back("'" + Strings::Escape(e.type) + "'");
|
||||
v.push_back(std::to_string(e.flag));
|
||||
v.push_back("'" + Strings::Escape(e.target) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.bug) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.date) + "'");
|
||||
v.push_back(std::to_string(e.status));
|
||||
|
||||
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_BUGS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_BUYER_REPOSITORY_H
|
||||
@@ -124,8 +124,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
buyer_id
|
||||
)
|
||||
);
|
||||
@@ -134,12 +135,12 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
Buyer e{};
|
||||
|
||||
e.charid = static_cast<int32_t>(atoi(row[0]));
|
||||
e.buyslot = static_cast<int32_t>(atoi(row[1]));
|
||||
e.itemid = static_cast<int32_t>(atoi(row[2]));
|
||||
e.charid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.buyslot = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.itemid = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
e.itemname = row[3] ? row[3] : "";
|
||||
e.quantity = static_cast<int32_t>(atoi(row[4]));
|
||||
e.price = static_cast<int32_t>(atoi(row[5]));
|
||||
e.quantity = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||
e.price = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -274,12 +275,12 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
Buyer e{};
|
||||
|
||||
e.charid = static_cast<int32_t>(atoi(row[0]));
|
||||
e.buyslot = static_cast<int32_t>(atoi(row[1]));
|
||||
e.itemid = static_cast<int32_t>(atoi(row[2]));
|
||||
e.charid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.buyslot = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.itemid = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
e.itemname = row[3] ? row[3] : "";
|
||||
e.quantity = static_cast<int32_t>(atoi(row[4]));
|
||||
e.price = static_cast<int32_t>(atoi(row[5]));
|
||||
e.quantity = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||
e.price = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -304,12 +305,12 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
Buyer e{};
|
||||
|
||||
e.charid = static_cast<int32_t>(atoi(row[0]));
|
||||
e.buyslot = static_cast<int32_t>(atoi(row[1]));
|
||||
e.itemid = static_cast<int32_t>(atoi(row[2]));
|
||||
e.charid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.buyslot = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.itemid = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
e.itemname = row[3] ? row[3] : "";
|
||||
e.quantity = static_cast<int32_t>(atoi(row[4]));
|
||||
e.price = static_cast<int32_t>(atoi(row[5]));
|
||||
e.quantity = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||
e.price = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -368,6 +369,72 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const Buyer &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.charid));
|
||||
v.push_back(std::to_string(e.buyslot));
|
||||
v.push_back(std::to_string(e.itemid));
|
||||
v.push_back("'" + Strings::Escape(e.itemname) + "'");
|
||||
v.push_back(std::to_string(e.quantity));
|
||||
v.push_back(std::to_string(e.price));
|
||||
|
||||
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<Buyer> &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.buyslot));
|
||||
v.push_back(std::to_string(e.itemid));
|
||||
v.push_back("'" + Strings::Escape(e.itemname) + "'");
|
||||
v.push_back(std::to_string(e.quantity));
|
||||
v.push_back(std::to_string(e.price));
|
||||
|
||||
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_BUYER_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHAR_CREATE_COMBINATIONS_REPOSITORY_H
|
||||
@@ -124,8 +124,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
char_create_combinations_id
|
||||
)
|
||||
);
|
||||
@@ -134,12 +135,12 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharCreateCombinations e{};
|
||||
|
||||
e.allocation_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.race = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.class_ = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.deity = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.start_zone = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.expansions_req = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.allocation_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.race = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.class_ = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.deity = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.start_zone = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.expansions_req = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -274,12 +275,12 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharCreateCombinations e{};
|
||||
|
||||
e.allocation_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.race = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.class_ = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.deity = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.start_zone = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.expansions_req = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.allocation_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.race = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.class_ = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.deity = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.start_zone = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.expansions_req = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -304,12 +305,12 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharCreateCombinations e{};
|
||||
|
||||
e.allocation_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.race = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.class_ = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.deity = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.start_zone = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.expansions_req = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.allocation_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.race = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.class_ = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.deity = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.start_zone = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.expansions_req = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -368,6 +369,72 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharCreateCombinations &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.allocation_id));
|
||||
v.push_back(std::to_string(e.race));
|
||||
v.push_back(std::to_string(e.class_));
|
||||
v.push_back(std::to_string(e.deity));
|
||||
v.push_back(std::to_string(e.start_zone));
|
||||
v.push_back(std::to_string(e.expansions_req));
|
||||
|
||||
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<CharCreateCombinations> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.allocation_id));
|
||||
v.push_back(std::to_string(e.race));
|
||||
v.push_back(std::to_string(e.class_));
|
||||
v.push_back(std::to_string(e.deity));
|
||||
v.push_back(std::to_string(e.start_zone));
|
||||
v.push_back(std::to_string(e.expansions_req));
|
||||
|
||||
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_CHAR_CREATE_COMBINATIONS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHAR_CREATE_POINT_ALLOCATIONS_REPOSITORY_H
|
||||
@@ -160,8 +160,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
char_create_point_allocations_id
|
||||
)
|
||||
);
|
||||
@@ -170,21 +171,21 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharCreatePointAllocations e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.base_str = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.base_sta = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.base_dex = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.base_agi = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.base_int = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.base_wis = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.base_cha = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.alloc_str = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.alloc_sta = static_cast<uint32_t>(strtoul(row[9], nullptr, 10));
|
||||
e.alloc_dex = static_cast<uint32_t>(strtoul(row[10], nullptr, 10));
|
||||
e.alloc_agi = static_cast<uint32_t>(strtoul(row[11], nullptr, 10));
|
||||
e.alloc_int = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
||||
e.alloc_wis = static_cast<uint32_t>(strtoul(row[13], nullptr, 10));
|
||||
e.alloc_cha = static_cast<uint32_t>(strtoul(row[14], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.base_str = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.base_sta = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.base_dex = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.base_agi = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.base_int = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.base_wis = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.base_cha = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.alloc_str = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.alloc_sta = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.alloc_dex = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.alloc_agi = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.alloc_int = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.alloc_wis = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.alloc_cha = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -346,21 +347,21 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharCreatePointAllocations e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.base_str = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.base_sta = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.base_dex = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.base_agi = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.base_int = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.base_wis = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.base_cha = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.alloc_str = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.alloc_sta = static_cast<uint32_t>(strtoul(row[9], nullptr, 10));
|
||||
e.alloc_dex = static_cast<uint32_t>(strtoul(row[10], nullptr, 10));
|
||||
e.alloc_agi = static_cast<uint32_t>(strtoul(row[11], nullptr, 10));
|
||||
e.alloc_int = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
||||
e.alloc_wis = static_cast<uint32_t>(strtoul(row[13], nullptr, 10));
|
||||
e.alloc_cha = static_cast<uint32_t>(strtoul(row[14], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.base_str = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.base_sta = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.base_dex = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.base_agi = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.base_int = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.base_wis = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.base_cha = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.alloc_str = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.alloc_sta = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.alloc_dex = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.alloc_agi = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.alloc_int = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.alloc_wis = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.alloc_cha = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -385,21 +386,21 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharCreatePointAllocations e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.base_str = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.base_sta = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.base_dex = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.base_agi = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.base_int = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.base_wis = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.base_cha = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.alloc_str = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.alloc_sta = static_cast<uint32_t>(strtoul(row[9], nullptr, 10));
|
||||
e.alloc_dex = static_cast<uint32_t>(strtoul(row[10], nullptr, 10));
|
||||
e.alloc_agi = static_cast<uint32_t>(strtoul(row[11], nullptr, 10));
|
||||
e.alloc_int = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
||||
e.alloc_wis = static_cast<uint32_t>(strtoul(row[13], nullptr, 10));
|
||||
e.alloc_cha = static_cast<uint32_t>(strtoul(row[14], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.base_str = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.base_sta = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.base_dex = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.base_agi = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.base_int = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.base_wis = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.base_cha = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.alloc_str = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.alloc_sta = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.alloc_dex = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.alloc_agi = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.alloc_int = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.alloc_wis = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.alloc_cha = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -458,6 +459,90 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharCreatePointAllocations &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.base_str));
|
||||
v.push_back(std::to_string(e.base_sta));
|
||||
v.push_back(std::to_string(e.base_dex));
|
||||
v.push_back(std::to_string(e.base_agi));
|
||||
v.push_back(std::to_string(e.base_int));
|
||||
v.push_back(std::to_string(e.base_wis));
|
||||
v.push_back(std::to_string(e.base_cha));
|
||||
v.push_back(std::to_string(e.alloc_str));
|
||||
v.push_back(std::to_string(e.alloc_sta));
|
||||
v.push_back(std::to_string(e.alloc_dex));
|
||||
v.push_back(std::to_string(e.alloc_agi));
|
||||
v.push_back(std::to_string(e.alloc_int));
|
||||
v.push_back(std::to_string(e.alloc_wis));
|
||||
v.push_back(std::to_string(e.alloc_cha));
|
||||
|
||||
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<CharCreatePointAllocations> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.base_str));
|
||||
v.push_back(std::to_string(e.base_sta));
|
||||
v.push_back(std::to_string(e.base_dex));
|
||||
v.push_back(std::to_string(e.base_agi));
|
||||
v.push_back(std::to_string(e.base_int));
|
||||
v.push_back(std::to_string(e.base_wis));
|
||||
v.push_back(std::to_string(e.base_cha));
|
||||
v.push_back(std::to_string(e.alloc_str));
|
||||
v.push_back(std::to_string(e.alloc_sta));
|
||||
v.push_back(std::to_string(e.alloc_dex));
|
||||
v.push_back(std::to_string(e.alloc_agi));
|
||||
v.push_back(std::to_string(e.alloc_int));
|
||||
v.push_back(std::to_string(e.alloc_wis));
|
||||
v.push_back(std::to_string(e.alloc_cha));
|
||||
|
||||
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_CHAR_CREATE_POINT_ALLOCATIONS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHAR_RECIPE_LIST_REPOSITORY_H
|
||||
@@ -112,8 +112,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
char_recipe_list_id
|
||||
)
|
||||
);
|
||||
@@ -122,9 +123,9 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharRecipeList e{};
|
||||
|
||||
e.char_id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.recipe_id = static_cast<int32_t>(atoi(row[1]));
|
||||
e.madecount = static_cast<int32_t>(atoi(row[2]));
|
||||
e.char_id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.recipe_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.madecount = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -250,9 +251,9 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharRecipeList e{};
|
||||
|
||||
e.char_id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.recipe_id = static_cast<int32_t>(atoi(row[1]));
|
||||
e.madecount = static_cast<int32_t>(atoi(row[2]));
|
||||
e.char_id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.recipe_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.madecount = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -277,9 +278,9 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharRecipeList e{};
|
||||
|
||||
e.char_id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.recipe_id = static_cast<int32_t>(atoi(row[1]));
|
||||
e.madecount = static_cast<int32_t>(atoi(row[2]));
|
||||
e.char_id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.recipe_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.madecount = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -338,6 +339,66 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharRecipeList &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.char_id));
|
||||
v.push_back(std::to_string(e.recipe_id));
|
||||
v.push_back(std::to_string(e.madecount));
|
||||
|
||||
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<CharRecipeList> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.char_id));
|
||||
v.push_back(std::to_string(e.recipe_id));
|
||||
v.push_back(std::to_string(e.madecount));
|
||||
|
||||
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_CHAR_RECIPE_LIST_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_ACTIVITIES_REPOSITORY_H
|
||||
@@ -120,8 +120,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_activities_id
|
||||
)
|
||||
);
|
||||
@@ -130,11 +131,11 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterActivities e{};
|
||||
|
||||
e.charid = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.taskid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.activityid = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.donecount = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.completed = static_cast<int8_t>(atoi(row[4]));
|
||||
e.charid = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.taskid = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.activityid = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.donecount = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.completed = row[4] ? static_cast<int8_t>(atoi(row[4])) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -266,11 +267,11 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterActivities e{};
|
||||
|
||||
e.charid = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.taskid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.activityid = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.donecount = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.completed = static_cast<int8_t>(atoi(row[4]));
|
||||
e.charid = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.taskid = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.activityid = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.donecount = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.completed = row[4] ? static_cast<int8_t>(atoi(row[4])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -295,11 +296,11 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterActivities e{};
|
||||
|
||||
e.charid = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.taskid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.activityid = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.donecount = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.completed = static_cast<int8_t>(atoi(row[4]));
|
||||
e.charid = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.taskid = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.activityid = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.donecount = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.completed = row[4] ? static_cast<int8_t>(atoi(row[4])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -358,6 +359,70 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterActivities &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.charid));
|
||||
v.push_back(std::to_string(e.taskid));
|
||||
v.push_back(std::to_string(e.activityid));
|
||||
v.push_back(std::to_string(e.donecount));
|
||||
v.push_back(std::to_string(e.completed));
|
||||
|
||||
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<CharacterActivities> &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.taskid));
|
||||
v.push_back(std::to_string(e.activityid));
|
||||
v.push_back(std::to_string(e.donecount));
|
||||
v.push_back(std::to_string(e.completed));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_ACTIVITIES_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_ALT_CURRENCY_REPOSITORY_H
|
||||
@@ -112,8 +112,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_alt_currency_id
|
||||
)
|
||||
);
|
||||
@@ -122,9 +123,9 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterAltCurrency e{};
|
||||
|
||||
e.char_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.currency_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.amount = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.char_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.currency_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.amount = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -250,9 +251,9 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterAltCurrency e{};
|
||||
|
||||
e.char_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.currency_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.amount = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.char_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.currency_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.amount = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -277,9 +278,9 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterAltCurrency e{};
|
||||
|
||||
e.char_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.currency_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.amount = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.char_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.currency_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.amount = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -338,6 +339,66 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterAltCurrency &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.char_id));
|
||||
v.push_back(std::to_string(e.currency_id));
|
||||
v.push_back(std::to_string(e.amount));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int ReplaceMany(
|
||||
Database& db,
|
||||
const std::vector<CharacterAltCurrency> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.char_id));
|
||||
v.push_back(std::to_string(e.currency_id));
|
||||
v.push_back(std::to_string(e.amount));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_ALT_CURRENCY_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_ALTERNATE_ABILITIES_REPOSITORY_H
|
||||
@@ -116,8 +116,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_alternate_abilities_id
|
||||
)
|
||||
);
|
||||
@@ -126,10 +127,10 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterAlternateAbilities e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.aa_id = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.aa_value = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.charges = static_cast<uint16_t>(strtoul(row[3], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.aa_id = row[1] ? static_cast<uint16_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.aa_value = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.charges = row[3] ? static_cast<uint16_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -258,10 +259,10 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterAlternateAbilities e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.aa_id = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.aa_value = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.charges = static_cast<uint16_t>(strtoul(row[3], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.aa_id = row[1] ? static_cast<uint16_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.aa_value = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.charges = row[3] ? static_cast<uint16_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -286,10 +287,10 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterAlternateAbilities e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.aa_id = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.aa_value = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.charges = static_cast<uint16_t>(strtoul(row[3], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.aa_id = row[1] ? static_cast<uint16_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.aa_value = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.charges = row[3] ? static_cast<uint16_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -348,6 +349,68 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterAlternateAbilities &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.aa_id));
|
||||
v.push_back(std::to_string(e.aa_value));
|
||||
v.push_back(std::to_string(e.charges));
|
||||
|
||||
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<CharacterAlternateAbilities> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.aa_id));
|
||||
v.push_back(std::to_string(e.aa_value));
|
||||
v.push_back(std::to_string(e.charges));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_ALTERNATE_ABILITIES_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_AURAS_REPOSITORY_H
|
||||
@@ -112,8 +112,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_auras_id
|
||||
)
|
||||
);
|
||||
@@ -122,9 +123,9 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterAuras e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.slot = static_cast<int8_t>(atoi(row[1]));
|
||||
e.spell_id = static_cast<int32_t>(atoi(row[2]));
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.slot = row[1] ? static_cast<int8_t>(atoi(row[1])) : 0;
|
||||
e.spell_id = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -250,9 +251,9 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterAuras e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.slot = static_cast<int8_t>(atoi(row[1]));
|
||||
e.spell_id = static_cast<int32_t>(atoi(row[2]));
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.slot = row[1] ? static_cast<int8_t>(atoi(row[1])) : 0;
|
||||
e.spell_id = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -277,9 +278,9 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterAuras e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.slot = static_cast<int8_t>(atoi(row[1]));
|
||||
e.spell_id = static_cast<int32_t>(atoi(row[2]));
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.slot = row[1] ? static_cast<int8_t>(atoi(row[1])) : 0;
|
||||
e.spell_id = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -338,6 +339,66 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterAuras &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.slot));
|
||||
v.push_back(std::to_string(e.spell_id));
|
||||
|
||||
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<CharacterAuras> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.slot));
|
||||
v.push_back(std::to_string(e.spell_id));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_AURAS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_BANDOLIER_REPOSITORY_H
|
||||
@@ -124,8 +124,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_bandolier_id
|
||||
)
|
||||
);
|
||||
@@ -134,12 +135,12 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterBandolier e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.bandolier_id = static_cast<uint8_t>(strtoul(row[1], nullptr, 10));
|
||||
e.bandolier_slot = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.item_id = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.icon = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.bandolier_name = row[5] ? row[5] : "";
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.bandolier_id = row[1] ? static_cast<uint8_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.bandolier_slot = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.item_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.icon = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.bandolier_name = row[5] ? row[5] : "0";
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -274,12 +275,12 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterBandolier e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.bandolier_id = static_cast<uint8_t>(strtoul(row[1], nullptr, 10));
|
||||
e.bandolier_slot = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.item_id = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.icon = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.bandolier_name = row[5] ? row[5] : "";
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.bandolier_id = row[1] ? static_cast<uint8_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.bandolier_slot = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.item_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.icon = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.bandolier_name = row[5] ? row[5] : "0";
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -304,12 +305,12 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterBandolier e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.bandolier_id = static_cast<uint8_t>(strtoul(row[1], nullptr, 10));
|
||||
e.bandolier_slot = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.item_id = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.icon = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.bandolier_name = row[5] ? row[5] : "";
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.bandolier_id = row[1] ? static_cast<uint8_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.bandolier_slot = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.item_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.icon = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.bandolier_name = row[5] ? row[5] : "0";
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -368,6 +369,72 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterBandolier &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.bandolier_id));
|
||||
v.push_back(std::to_string(e.bandolier_slot));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.icon));
|
||||
v.push_back("'" + Strings::Escape(e.bandolier_name) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int ReplaceMany(
|
||||
Database& db,
|
||||
const std::vector<CharacterBandolier> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.bandolier_id));
|
||||
v.push_back(std::to_string(e.bandolier_slot));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.icon));
|
||||
v.push_back("'" + Strings::Escape(e.bandolier_name) + "'");
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_BANDOLIER_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_BIND_REPOSITORY_H
|
||||
@@ -132,8 +132,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_bind_id
|
||||
)
|
||||
);
|
||||
@@ -142,14 +143,14 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterBind e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.slot = static_cast<int32_t>(atoi(row[1]));
|
||||
e.zone_id = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.instance_id = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.x = strtof(row[4], nullptr);
|
||||
e.y = strtof(row[5], nullptr);
|
||||
e.z = strtof(row[6], nullptr);
|
||||
e.heading = strtof(row[7], nullptr);
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.slot = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.zone_id = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.instance_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.x = row[4] ? strtof(row[4], nullptr) : 0;
|
||||
e.y = row[5] ? strtof(row[5], nullptr) : 0;
|
||||
e.z = row[6] ? strtof(row[6], nullptr) : 0;
|
||||
e.heading = row[7] ? strtof(row[7], nullptr) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -289,14 +290,14 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterBind e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.slot = static_cast<int32_t>(atoi(row[1]));
|
||||
e.zone_id = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.instance_id = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.x = strtof(row[4], nullptr);
|
||||
e.y = strtof(row[5], nullptr);
|
||||
e.z = strtof(row[6], nullptr);
|
||||
e.heading = strtof(row[7], nullptr);
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.slot = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.zone_id = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.instance_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.x = row[4] ? strtof(row[4], nullptr) : 0;
|
||||
e.y = row[5] ? strtof(row[5], nullptr) : 0;
|
||||
e.z = row[6] ? strtof(row[6], nullptr) : 0;
|
||||
e.heading = row[7] ? strtof(row[7], nullptr) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -321,14 +322,14 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterBind e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.slot = static_cast<int32_t>(atoi(row[1]));
|
||||
e.zone_id = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.instance_id = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.x = strtof(row[4], nullptr);
|
||||
e.y = strtof(row[5], nullptr);
|
||||
e.z = strtof(row[6], nullptr);
|
||||
e.heading = strtof(row[7], nullptr);
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.slot = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.zone_id = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.instance_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.x = row[4] ? strtof(row[4], nullptr) : 0;
|
||||
e.y = row[5] ? strtof(row[5], nullptr) : 0;
|
||||
e.z = row[6] ? strtof(row[6], nullptr) : 0;
|
||||
e.heading = row[7] ? strtof(row[7], nullptr) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -387,6 +388,76 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterBind &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.slot));
|
||||
v.push_back(std::to_string(e.zone_id));
|
||||
v.push_back(std::to_string(e.instance_id));
|
||||
v.push_back(std::to_string(e.x));
|
||||
v.push_back(std::to_string(e.y));
|
||||
v.push_back(std::to_string(e.z));
|
||||
v.push_back(std::to_string(e.heading));
|
||||
|
||||
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<CharacterBind> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.slot));
|
||||
v.push_back(std::to_string(e.zone_id));
|
||||
v.push_back(std::to_string(e.instance_id));
|
||||
v.push_back(std::to_string(e.x));
|
||||
v.push_back(std::to_string(e.y));
|
||||
v.push_back(std::to_string(e.z));
|
||||
v.push_back(std::to_string(e.heading));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_BIND_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_BUFFS_REPOSITORY_H
|
||||
@@ -168,8 +168,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_buffs_id
|
||||
)
|
||||
);
|
||||
@@ -178,23 +179,23 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterBuffs e{};
|
||||
|
||||
e.character_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.slot_id = static_cast<uint8_t>(strtoul(row[1], nullptr, 10));
|
||||
e.spell_id = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.caster_level = static_cast<uint8_t>(strtoul(row[3], nullptr, 10));
|
||||
e.character_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.slot_id = row[1] ? static_cast<uint8_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.spell_id = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.caster_level = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.caster_name = row[4] ? row[4] : "";
|
||||
e.ticsremaining = static_cast<int32_t>(atoi(row[5]));
|
||||
e.counters = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.numhits = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.melee_rune = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.magic_rune = static_cast<uint32_t>(strtoul(row[9], nullptr, 10));
|
||||
e.persistent = static_cast<uint8_t>(strtoul(row[10], nullptr, 10));
|
||||
e.dot_rune = static_cast<int32_t>(atoi(row[11]));
|
||||
e.caston_x = static_cast<int32_t>(atoi(row[12]));
|
||||
e.caston_y = static_cast<int32_t>(atoi(row[13]));
|
||||
e.caston_z = static_cast<int32_t>(atoi(row[14]));
|
||||
e.ExtraDIChance = static_cast<int32_t>(atoi(row[15]));
|
||||
e.instrument_mod = static_cast<int32_t>(atoi(row[16]));
|
||||
e.ticsremaining = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
|
||||
e.counters = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.numhits = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.melee_rune = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.magic_rune = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.persistent = row[10] ? static_cast<uint8_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.dot_rune = row[11] ? static_cast<int32_t>(atoi(row[11])) : 0;
|
||||
e.caston_x = row[12] ? static_cast<int32_t>(atoi(row[12])) : 0;
|
||||
e.caston_y = row[13] ? static_cast<int32_t>(atoi(row[13])) : 0;
|
||||
e.caston_z = row[14] ? static_cast<int32_t>(atoi(row[14])) : 0;
|
||||
e.ExtraDIChance = row[15] ? static_cast<int32_t>(atoi(row[15])) : 0;
|
||||
e.instrument_mod = row[16] ? static_cast<int32_t>(atoi(row[16])) : 10;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -362,23 +363,23 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterBuffs e{};
|
||||
|
||||
e.character_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.slot_id = static_cast<uint8_t>(strtoul(row[1], nullptr, 10));
|
||||
e.spell_id = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.caster_level = static_cast<uint8_t>(strtoul(row[3], nullptr, 10));
|
||||
e.character_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.slot_id = row[1] ? static_cast<uint8_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.spell_id = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.caster_level = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.caster_name = row[4] ? row[4] : "";
|
||||
e.ticsremaining = static_cast<int32_t>(atoi(row[5]));
|
||||
e.counters = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.numhits = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.melee_rune = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.magic_rune = static_cast<uint32_t>(strtoul(row[9], nullptr, 10));
|
||||
e.persistent = static_cast<uint8_t>(strtoul(row[10], nullptr, 10));
|
||||
e.dot_rune = static_cast<int32_t>(atoi(row[11]));
|
||||
e.caston_x = static_cast<int32_t>(atoi(row[12]));
|
||||
e.caston_y = static_cast<int32_t>(atoi(row[13]));
|
||||
e.caston_z = static_cast<int32_t>(atoi(row[14]));
|
||||
e.ExtraDIChance = static_cast<int32_t>(atoi(row[15]));
|
||||
e.instrument_mod = static_cast<int32_t>(atoi(row[16]));
|
||||
e.ticsremaining = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
|
||||
e.counters = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.numhits = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.melee_rune = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.magic_rune = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.persistent = row[10] ? static_cast<uint8_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.dot_rune = row[11] ? static_cast<int32_t>(atoi(row[11])) : 0;
|
||||
e.caston_x = row[12] ? static_cast<int32_t>(atoi(row[12])) : 0;
|
||||
e.caston_y = row[13] ? static_cast<int32_t>(atoi(row[13])) : 0;
|
||||
e.caston_z = row[14] ? static_cast<int32_t>(atoi(row[14])) : 0;
|
||||
e.ExtraDIChance = row[15] ? static_cast<int32_t>(atoi(row[15])) : 0;
|
||||
e.instrument_mod = row[16] ? static_cast<int32_t>(atoi(row[16])) : 10;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -403,23 +404,23 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterBuffs e{};
|
||||
|
||||
e.character_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.slot_id = static_cast<uint8_t>(strtoul(row[1], nullptr, 10));
|
||||
e.spell_id = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.caster_level = static_cast<uint8_t>(strtoul(row[3], nullptr, 10));
|
||||
e.character_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.slot_id = row[1] ? static_cast<uint8_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.spell_id = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.caster_level = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.caster_name = row[4] ? row[4] : "";
|
||||
e.ticsremaining = static_cast<int32_t>(atoi(row[5]));
|
||||
e.counters = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.numhits = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.melee_rune = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.magic_rune = static_cast<uint32_t>(strtoul(row[9], nullptr, 10));
|
||||
e.persistent = static_cast<uint8_t>(strtoul(row[10], nullptr, 10));
|
||||
e.dot_rune = static_cast<int32_t>(atoi(row[11]));
|
||||
e.caston_x = static_cast<int32_t>(atoi(row[12]));
|
||||
e.caston_y = static_cast<int32_t>(atoi(row[13]));
|
||||
e.caston_z = static_cast<int32_t>(atoi(row[14]));
|
||||
e.ExtraDIChance = static_cast<int32_t>(atoi(row[15]));
|
||||
e.instrument_mod = static_cast<int32_t>(atoi(row[16]));
|
||||
e.ticsremaining = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
|
||||
e.counters = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.numhits = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.melee_rune = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.magic_rune = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.persistent = row[10] ? static_cast<uint8_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.dot_rune = row[11] ? static_cast<int32_t>(atoi(row[11])) : 0;
|
||||
e.caston_x = row[12] ? static_cast<int32_t>(atoi(row[12])) : 0;
|
||||
e.caston_y = row[13] ? static_cast<int32_t>(atoi(row[13])) : 0;
|
||||
e.caston_z = row[14] ? static_cast<int32_t>(atoi(row[14])) : 0;
|
||||
e.ExtraDIChance = row[15] ? static_cast<int32_t>(atoi(row[15])) : 0;
|
||||
e.instrument_mod = row[16] ? static_cast<int32_t>(atoi(row[16])) : 10;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -478,6 +479,94 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterBuffs &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.character_id));
|
||||
v.push_back(std::to_string(e.slot_id));
|
||||
v.push_back(std::to_string(e.spell_id));
|
||||
v.push_back(std::to_string(e.caster_level));
|
||||
v.push_back("'" + Strings::Escape(e.caster_name) + "'");
|
||||
v.push_back(std::to_string(e.ticsremaining));
|
||||
v.push_back(std::to_string(e.counters));
|
||||
v.push_back(std::to_string(e.numhits));
|
||||
v.push_back(std::to_string(e.melee_rune));
|
||||
v.push_back(std::to_string(e.magic_rune));
|
||||
v.push_back(std::to_string(e.persistent));
|
||||
v.push_back(std::to_string(e.dot_rune));
|
||||
v.push_back(std::to_string(e.caston_x));
|
||||
v.push_back(std::to_string(e.caston_y));
|
||||
v.push_back(std::to_string(e.caston_z));
|
||||
v.push_back(std::to_string(e.ExtraDIChance));
|
||||
v.push_back(std::to_string(e.instrument_mod));
|
||||
|
||||
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<CharacterBuffs> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.character_id));
|
||||
v.push_back(std::to_string(e.slot_id));
|
||||
v.push_back(std::to_string(e.spell_id));
|
||||
v.push_back(std::to_string(e.caster_level));
|
||||
v.push_back("'" + Strings::Escape(e.caster_name) + "'");
|
||||
v.push_back(std::to_string(e.ticsremaining));
|
||||
v.push_back(std::to_string(e.counters));
|
||||
v.push_back(std::to_string(e.numhits));
|
||||
v.push_back(std::to_string(e.melee_rune));
|
||||
v.push_back(std::to_string(e.magic_rune));
|
||||
v.push_back(std::to_string(e.persistent));
|
||||
v.push_back(std::to_string(e.dot_rune));
|
||||
v.push_back(std::to_string(e.caston_x));
|
||||
v.push_back(std::to_string(e.caston_y));
|
||||
v.push_back(std::to_string(e.caston_z));
|
||||
v.push_back(std::to_string(e.ExtraDIChance));
|
||||
v.push_back(std::to_string(e.instrument_mod));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_BUFFS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_CORPSE_ITEMS_REPOSITORY_H
|
||||
@@ -19,17 +19,21 @@
|
||||
class BaseCharacterCorpseItemsRepository {
|
||||
public:
|
||||
struct CharacterCorpseItems {
|
||||
uint32_t corpse_id;
|
||||
uint32_t equip_slot;
|
||||
uint32_t item_id;
|
||||
uint32_t charges;
|
||||
uint32_t aug_1;
|
||||
uint32_t aug_2;
|
||||
uint32_t aug_3;
|
||||
uint32_t aug_4;
|
||||
uint32_t aug_5;
|
||||
int32_t aug_6;
|
||||
int16_t attuned;
|
||||
uint32_t corpse_id;
|
||||
uint32_t equip_slot;
|
||||
uint32_t item_id;
|
||||
uint32_t charges;
|
||||
uint32_t aug_1;
|
||||
uint32_t aug_2;
|
||||
uint32_t aug_3;
|
||||
uint32_t aug_4;
|
||||
uint32_t aug_5;
|
||||
int32_t aug_6;
|
||||
int16_t attuned;
|
||||
std::string custom_data;
|
||||
uint32_t ornamenticon;
|
||||
uint32_t ornamentidfile;
|
||||
uint32_t ornament_hero_model;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
@@ -51,6 +55,10 @@ public:
|
||||
"aug_5",
|
||||
"aug_6",
|
||||
"attuned",
|
||||
"custom_data",
|
||||
"ornamenticon",
|
||||
"ornamentidfile",
|
||||
"ornament_hero_model",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -68,6 +76,10 @@ public:
|
||||
"aug_5",
|
||||
"aug_6",
|
||||
"attuned",
|
||||
"custom_data",
|
||||
"ornamenticon",
|
||||
"ornamentidfile",
|
||||
"ornament_hero_model",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -108,17 +120,21 @@ public:
|
||||
{
|
||||
CharacterCorpseItems e{};
|
||||
|
||||
e.corpse_id = 0;
|
||||
e.equip_slot = 0;
|
||||
e.item_id = 0;
|
||||
e.charges = 0;
|
||||
e.aug_1 = 0;
|
||||
e.aug_2 = 0;
|
||||
e.aug_3 = 0;
|
||||
e.aug_4 = 0;
|
||||
e.aug_5 = 0;
|
||||
e.aug_6 = 0;
|
||||
e.attuned = 0;
|
||||
e.corpse_id = 0;
|
||||
e.equip_slot = 0;
|
||||
e.item_id = 0;
|
||||
e.charges = 0;
|
||||
e.aug_1 = 0;
|
||||
e.aug_2 = 0;
|
||||
e.aug_3 = 0;
|
||||
e.aug_4 = 0;
|
||||
e.aug_5 = 0;
|
||||
e.aug_6 = 0;
|
||||
e.attuned = 0;
|
||||
e.custom_data = "";
|
||||
e.ornamenticon = 0;
|
||||
e.ornamentidfile = 0;
|
||||
e.ornament_hero_model = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -144,8 +160,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_corpse_items_id
|
||||
)
|
||||
);
|
||||
@@ -154,17 +171,21 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterCorpseItems e{};
|
||||
|
||||
e.corpse_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.equip_slot = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.item_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.charges = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.aug_1 = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.aug_2 = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.aug_3 = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.aug_4 = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.aug_5 = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.aug_6 = static_cast<int32_t>(atoi(row[9]));
|
||||
e.attuned = static_cast<int16_t>(atoi(row[10]));
|
||||
e.corpse_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.equip_slot = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.item_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.charges = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.aug_1 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.aug_2 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_3 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_4 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_5 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.aug_6 = row[9] ? static_cast<int32_t>(atoi(row[9])) : 0;
|
||||
e.attuned = row[10] ? static_cast<int16_t>(atoi(row[10])) : 0;
|
||||
e.custom_data = row[11] ? row[11] : "";
|
||||
e.ornamenticon = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.ornamentidfile = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.ornament_hero_model = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -209,6 +230,10 @@ public:
|
||||
v.push_back(columns[8] + " = " + std::to_string(e.aug_5));
|
||||
v.push_back(columns[9] + " = " + std::to_string(e.aug_6));
|
||||
v.push_back(columns[10] + " = " + std::to_string(e.attuned));
|
||||
v.push_back(columns[11] + " = '" + Strings::Escape(e.custom_data) + "'");
|
||||
v.push_back(columns[12] + " = " + std::to_string(e.ornamenticon));
|
||||
v.push_back(columns[13] + " = " + std::to_string(e.ornamentidfile));
|
||||
v.push_back(columns[14] + " = " + std::to_string(e.ornament_hero_model));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -241,6 +266,10 @@ public:
|
||||
v.push_back(std::to_string(e.aug_5));
|
||||
v.push_back(std::to_string(e.aug_6));
|
||||
v.push_back(std::to_string(e.attuned));
|
||||
v.push_back("'" + Strings::Escape(e.custom_data) + "'");
|
||||
v.push_back(std::to_string(e.ornamenticon));
|
||||
v.push_back(std::to_string(e.ornamentidfile));
|
||||
v.push_back(std::to_string(e.ornament_hero_model));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -281,6 +310,10 @@ public:
|
||||
v.push_back(std::to_string(e.aug_5));
|
||||
v.push_back(std::to_string(e.aug_6));
|
||||
v.push_back(std::to_string(e.attuned));
|
||||
v.push_back("'" + Strings::Escape(e.custom_data) + "'");
|
||||
v.push_back(std::to_string(e.ornamenticon));
|
||||
v.push_back(std::to_string(e.ornamentidfile));
|
||||
v.push_back(std::to_string(e.ornament_hero_model));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
@@ -314,17 +347,21 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterCorpseItems e{};
|
||||
|
||||
e.corpse_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.equip_slot = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.item_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.charges = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.aug_1 = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.aug_2 = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.aug_3 = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.aug_4 = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.aug_5 = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.aug_6 = static_cast<int32_t>(atoi(row[9]));
|
||||
e.attuned = static_cast<int16_t>(atoi(row[10]));
|
||||
e.corpse_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.equip_slot = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.item_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.charges = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.aug_1 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.aug_2 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_3 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_4 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_5 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.aug_6 = row[9] ? static_cast<int32_t>(atoi(row[9])) : 0;
|
||||
e.attuned = row[10] ? static_cast<int16_t>(atoi(row[10])) : 0;
|
||||
e.custom_data = row[11] ? row[11] : "";
|
||||
e.ornamenticon = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.ornamentidfile = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.ornament_hero_model = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -349,17 +386,21 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterCorpseItems e{};
|
||||
|
||||
e.corpse_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.equip_slot = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.item_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.charges = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.aug_1 = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.aug_2 = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.aug_3 = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.aug_4 = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.aug_5 = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.aug_6 = static_cast<int32_t>(atoi(row[9]));
|
||||
e.attuned = static_cast<int16_t>(atoi(row[10]));
|
||||
e.corpse_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.equip_slot = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.item_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.charges = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.aug_1 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.aug_2 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_3 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_4 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_5 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.aug_6 = row[9] ? static_cast<int32_t>(atoi(row[9])) : 0;
|
||||
e.attuned = row[10] ? static_cast<int16_t>(atoi(row[10])) : 0;
|
||||
e.custom_data = row[11] ? row[11] : "";
|
||||
e.ornamenticon = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.ornamentidfile = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.ornament_hero_model = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -418,6 +459,90 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterCorpseItems &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.corpse_id));
|
||||
v.push_back(std::to_string(e.equip_slot));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.charges));
|
||||
v.push_back(std::to_string(e.aug_1));
|
||||
v.push_back(std::to_string(e.aug_2));
|
||||
v.push_back(std::to_string(e.aug_3));
|
||||
v.push_back(std::to_string(e.aug_4));
|
||||
v.push_back(std::to_string(e.aug_5));
|
||||
v.push_back(std::to_string(e.aug_6));
|
||||
v.push_back(std::to_string(e.attuned));
|
||||
v.push_back("'" + Strings::Escape(e.custom_data) + "'");
|
||||
v.push_back(std::to_string(e.ornamenticon));
|
||||
v.push_back(std::to_string(e.ornamentidfile));
|
||||
v.push_back(std::to_string(e.ornament_hero_model));
|
||||
|
||||
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<CharacterCorpseItems> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.corpse_id));
|
||||
v.push_back(std::to_string(e.equip_slot));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.charges));
|
||||
v.push_back(std::to_string(e.aug_1));
|
||||
v.push_back(std::to_string(e.aug_2));
|
||||
v.push_back(std::to_string(e.aug_3));
|
||||
v.push_back(std::to_string(e.aug_4));
|
||||
v.push_back(std::to_string(e.aug_5));
|
||||
v.push_back(std::to_string(e.aug_6));
|
||||
v.push_back(std::to_string(e.attuned));
|
||||
v.push_back("'" + Strings::Escape(e.custom_data) + "'");
|
||||
v.push_back(std::to_string(e.ornamenticon));
|
||||
v.push_back(std::to_string(e.ornamentidfile));
|
||||
v.push_back(std::to_string(e.ornament_hero_model));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_CORPSE_ITEMS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_CORPSES_REPOSITORY_H
|
||||
@@ -288,8 +288,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_corpses_id
|
||||
)
|
||||
);
|
||||
@@ -298,53 +299,53 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterCorpses e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.charid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.charid = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.charname = row[2] ? row[2] : "";
|
||||
e.zone_id = static_cast<int16_t>(atoi(row[3]));
|
||||
e.instance_id = static_cast<uint16_t>(strtoul(row[4], nullptr, 10));
|
||||
e.x = strtof(row[5], nullptr);
|
||||
e.y = strtof(row[6], nullptr);
|
||||
e.z = strtof(row[7], nullptr);
|
||||
e.heading = strtof(row[8], nullptr);
|
||||
e.zone_id = row[3] ? static_cast<int16_t>(atoi(row[3])) : 0;
|
||||
e.instance_id = row[4] ? static_cast<uint16_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.x = row[5] ? strtof(row[5], nullptr) : 0;
|
||||
e.y = row[6] ? strtof(row[6], nullptr) : 0;
|
||||
e.z = row[7] ? strtof(row[7], nullptr) : 0;
|
||||
e.heading = row[8] ? strtof(row[8], nullptr) : 0;
|
||||
e.time_of_death = strtoll(row[9] ? row[9] : "-1", nullptr, 10);
|
||||
e.guild_consent_id = static_cast<uint32_t>(strtoul(row[10], nullptr, 10));
|
||||
e.is_rezzed = static_cast<uint8_t>(strtoul(row[11], nullptr, 10));
|
||||
e.is_buried = static_cast<int8_t>(atoi(row[12]));
|
||||
e.was_at_graveyard = static_cast<int8_t>(atoi(row[13]));
|
||||
e.is_locked = static_cast<int8_t>(atoi(row[14]));
|
||||
e.exp = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
||||
e.size = static_cast<uint32_t>(strtoul(row[16], nullptr, 10));
|
||||
e.level = static_cast<uint32_t>(strtoul(row[17], nullptr, 10));
|
||||
e.race = static_cast<uint32_t>(strtoul(row[18], nullptr, 10));
|
||||
e.gender = static_cast<uint32_t>(strtoul(row[19], nullptr, 10));
|
||||
e.class_ = static_cast<uint32_t>(strtoul(row[20], nullptr, 10));
|
||||
e.deity = static_cast<uint32_t>(strtoul(row[21], nullptr, 10));
|
||||
e.texture = static_cast<uint32_t>(strtoul(row[22], nullptr, 10));
|
||||
e.helm_texture = static_cast<uint32_t>(strtoul(row[23], nullptr, 10));
|
||||
e.copper = static_cast<uint32_t>(strtoul(row[24], nullptr, 10));
|
||||
e.silver = static_cast<uint32_t>(strtoul(row[25], nullptr, 10));
|
||||
e.gold = static_cast<uint32_t>(strtoul(row[26], nullptr, 10));
|
||||
e.platinum = static_cast<uint32_t>(strtoul(row[27], nullptr, 10));
|
||||
e.hair_color = static_cast<uint32_t>(strtoul(row[28], nullptr, 10));
|
||||
e.beard_color = static_cast<uint32_t>(strtoul(row[29], nullptr, 10));
|
||||
e.eye_color_1 = static_cast<uint32_t>(strtoul(row[30], nullptr, 10));
|
||||
e.eye_color_2 = static_cast<uint32_t>(strtoul(row[31], nullptr, 10));
|
||||
e.hair_style = static_cast<uint32_t>(strtoul(row[32], nullptr, 10));
|
||||
e.face = static_cast<uint32_t>(strtoul(row[33], nullptr, 10));
|
||||
e.beard = static_cast<uint32_t>(strtoul(row[34], nullptr, 10));
|
||||
e.drakkin_heritage = static_cast<uint32_t>(strtoul(row[35], nullptr, 10));
|
||||
e.drakkin_tattoo = static_cast<uint32_t>(strtoul(row[36], nullptr, 10));
|
||||
e.drakkin_details = static_cast<uint32_t>(strtoul(row[37], nullptr, 10));
|
||||
e.wc_1 = static_cast<uint32_t>(strtoul(row[38], nullptr, 10));
|
||||
e.wc_2 = static_cast<uint32_t>(strtoul(row[39], nullptr, 10));
|
||||
e.wc_3 = static_cast<uint32_t>(strtoul(row[40], nullptr, 10));
|
||||
e.wc_4 = static_cast<uint32_t>(strtoul(row[41], nullptr, 10));
|
||||
e.wc_5 = static_cast<uint32_t>(strtoul(row[42], nullptr, 10));
|
||||
e.wc_6 = static_cast<uint32_t>(strtoul(row[43], nullptr, 10));
|
||||
e.wc_7 = static_cast<uint32_t>(strtoul(row[44], nullptr, 10));
|
||||
e.wc_8 = static_cast<uint32_t>(strtoul(row[45], nullptr, 10));
|
||||
e.wc_9 = static_cast<uint32_t>(strtoul(row[46], nullptr, 10));
|
||||
e.guild_consent_id = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.is_rezzed = row[11] ? static_cast<uint8_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.is_buried = row[12] ? static_cast<int8_t>(atoi(row[12])) : 0;
|
||||
e.was_at_graveyard = row[13] ? static_cast<int8_t>(atoi(row[13])) : 0;
|
||||
e.is_locked = row[14] ? static_cast<int8_t>(atoi(row[14])) : 0;
|
||||
e.exp = row[15] ? static_cast<uint32_t>(strtoul(row[15], nullptr, 10)) : 0;
|
||||
e.size = row[16] ? static_cast<uint32_t>(strtoul(row[16], nullptr, 10)) : 0;
|
||||
e.level = row[17] ? static_cast<uint32_t>(strtoul(row[17], nullptr, 10)) : 0;
|
||||
e.race = row[18] ? static_cast<uint32_t>(strtoul(row[18], nullptr, 10)) : 0;
|
||||
e.gender = row[19] ? static_cast<uint32_t>(strtoul(row[19], nullptr, 10)) : 0;
|
||||
e.class_ = row[20] ? static_cast<uint32_t>(strtoul(row[20], nullptr, 10)) : 0;
|
||||
e.deity = row[21] ? static_cast<uint32_t>(strtoul(row[21], nullptr, 10)) : 0;
|
||||
e.texture = row[22] ? static_cast<uint32_t>(strtoul(row[22], nullptr, 10)) : 0;
|
||||
e.helm_texture = row[23] ? static_cast<uint32_t>(strtoul(row[23], nullptr, 10)) : 0;
|
||||
e.copper = row[24] ? static_cast<uint32_t>(strtoul(row[24], nullptr, 10)) : 0;
|
||||
e.silver = row[25] ? static_cast<uint32_t>(strtoul(row[25], nullptr, 10)) : 0;
|
||||
e.gold = row[26] ? static_cast<uint32_t>(strtoul(row[26], nullptr, 10)) : 0;
|
||||
e.platinum = row[27] ? static_cast<uint32_t>(strtoul(row[27], nullptr, 10)) : 0;
|
||||
e.hair_color = row[28] ? static_cast<uint32_t>(strtoul(row[28], nullptr, 10)) : 0;
|
||||
e.beard_color = row[29] ? static_cast<uint32_t>(strtoul(row[29], nullptr, 10)) : 0;
|
||||
e.eye_color_1 = row[30] ? static_cast<uint32_t>(strtoul(row[30], nullptr, 10)) : 0;
|
||||
e.eye_color_2 = row[31] ? static_cast<uint32_t>(strtoul(row[31], nullptr, 10)) : 0;
|
||||
e.hair_style = row[32] ? static_cast<uint32_t>(strtoul(row[32], nullptr, 10)) : 0;
|
||||
e.face = row[33] ? static_cast<uint32_t>(strtoul(row[33], nullptr, 10)) : 0;
|
||||
e.beard = row[34] ? static_cast<uint32_t>(strtoul(row[34], nullptr, 10)) : 0;
|
||||
e.drakkin_heritage = row[35] ? static_cast<uint32_t>(strtoul(row[35], nullptr, 10)) : 0;
|
||||
e.drakkin_tattoo = row[36] ? static_cast<uint32_t>(strtoul(row[36], nullptr, 10)) : 0;
|
||||
e.drakkin_details = row[37] ? static_cast<uint32_t>(strtoul(row[37], nullptr, 10)) : 0;
|
||||
e.wc_1 = row[38] ? static_cast<uint32_t>(strtoul(row[38], nullptr, 10)) : 0;
|
||||
e.wc_2 = row[39] ? static_cast<uint32_t>(strtoul(row[39], nullptr, 10)) : 0;
|
||||
e.wc_3 = row[40] ? static_cast<uint32_t>(strtoul(row[40], nullptr, 10)) : 0;
|
||||
e.wc_4 = row[41] ? static_cast<uint32_t>(strtoul(row[41], nullptr, 10)) : 0;
|
||||
e.wc_5 = row[42] ? static_cast<uint32_t>(strtoul(row[42], nullptr, 10)) : 0;
|
||||
e.wc_6 = row[43] ? static_cast<uint32_t>(strtoul(row[43], nullptr, 10)) : 0;
|
||||
e.wc_7 = row[44] ? static_cast<uint32_t>(strtoul(row[44], nullptr, 10)) : 0;
|
||||
e.wc_8 = row[45] ? static_cast<uint32_t>(strtoul(row[45], nullptr, 10)) : 0;
|
||||
e.wc_9 = row[46] ? static_cast<uint32_t>(strtoul(row[46], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -601,53 +602,53 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterCorpses e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.charid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.charid = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.charname = row[2] ? row[2] : "";
|
||||
e.zone_id = static_cast<int16_t>(atoi(row[3]));
|
||||
e.instance_id = static_cast<uint16_t>(strtoul(row[4], nullptr, 10));
|
||||
e.x = strtof(row[5], nullptr);
|
||||
e.y = strtof(row[6], nullptr);
|
||||
e.z = strtof(row[7], nullptr);
|
||||
e.heading = strtof(row[8], nullptr);
|
||||
e.zone_id = row[3] ? static_cast<int16_t>(atoi(row[3])) : 0;
|
||||
e.instance_id = row[4] ? static_cast<uint16_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.x = row[5] ? strtof(row[5], nullptr) : 0;
|
||||
e.y = row[6] ? strtof(row[6], nullptr) : 0;
|
||||
e.z = row[7] ? strtof(row[7], nullptr) : 0;
|
||||
e.heading = row[8] ? strtof(row[8], nullptr) : 0;
|
||||
e.time_of_death = strtoll(row[9] ? row[9] : "-1", nullptr, 10);
|
||||
e.guild_consent_id = static_cast<uint32_t>(strtoul(row[10], nullptr, 10));
|
||||
e.is_rezzed = static_cast<uint8_t>(strtoul(row[11], nullptr, 10));
|
||||
e.is_buried = static_cast<int8_t>(atoi(row[12]));
|
||||
e.was_at_graveyard = static_cast<int8_t>(atoi(row[13]));
|
||||
e.is_locked = static_cast<int8_t>(atoi(row[14]));
|
||||
e.exp = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
||||
e.size = static_cast<uint32_t>(strtoul(row[16], nullptr, 10));
|
||||
e.level = static_cast<uint32_t>(strtoul(row[17], nullptr, 10));
|
||||
e.race = static_cast<uint32_t>(strtoul(row[18], nullptr, 10));
|
||||
e.gender = static_cast<uint32_t>(strtoul(row[19], nullptr, 10));
|
||||
e.class_ = static_cast<uint32_t>(strtoul(row[20], nullptr, 10));
|
||||
e.deity = static_cast<uint32_t>(strtoul(row[21], nullptr, 10));
|
||||
e.texture = static_cast<uint32_t>(strtoul(row[22], nullptr, 10));
|
||||
e.helm_texture = static_cast<uint32_t>(strtoul(row[23], nullptr, 10));
|
||||
e.copper = static_cast<uint32_t>(strtoul(row[24], nullptr, 10));
|
||||
e.silver = static_cast<uint32_t>(strtoul(row[25], nullptr, 10));
|
||||
e.gold = static_cast<uint32_t>(strtoul(row[26], nullptr, 10));
|
||||
e.platinum = static_cast<uint32_t>(strtoul(row[27], nullptr, 10));
|
||||
e.hair_color = static_cast<uint32_t>(strtoul(row[28], nullptr, 10));
|
||||
e.beard_color = static_cast<uint32_t>(strtoul(row[29], nullptr, 10));
|
||||
e.eye_color_1 = static_cast<uint32_t>(strtoul(row[30], nullptr, 10));
|
||||
e.eye_color_2 = static_cast<uint32_t>(strtoul(row[31], nullptr, 10));
|
||||
e.hair_style = static_cast<uint32_t>(strtoul(row[32], nullptr, 10));
|
||||
e.face = static_cast<uint32_t>(strtoul(row[33], nullptr, 10));
|
||||
e.beard = static_cast<uint32_t>(strtoul(row[34], nullptr, 10));
|
||||
e.drakkin_heritage = static_cast<uint32_t>(strtoul(row[35], nullptr, 10));
|
||||
e.drakkin_tattoo = static_cast<uint32_t>(strtoul(row[36], nullptr, 10));
|
||||
e.drakkin_details = static_cast<uint32_t>(strtoul(row[37], nullptr, 10));
|
||||
e.wc_1 = static_cast<uint32_t>(strtoul(row[38], nullptr, 10));
|
||||
e.wc_2 = static_cast<uint32_t>(strtoul(row[39], nullptr, 10));
|
||||
e.wc_3 = static_cast<uint32_t>(strtoul(row[40], nullptr, 10));
|
||||
e.wc_4 = static_cast<uint32_t>(strtoul(row[41], nullptr, 10));
|
||||
e.wc_5 = static_cast<uint32_t>(strtoul(row[42], nullptr, 10));
|
||||
e.wc_6 = static_cast<uint32_t>(strtoul(row[43], nullptr, 10));
|
||||
e.wc_7 = static_cast<uint32_t>(strtoul(row[44], nullptr, 10));
|
||||
e.wc_8 = static_cast<uint32_t>(strtoul(row[45], nullptr, 10));
|
||||
e.wc_9 = static_cast<uint32_t>(strtoul(row[46], nullptr, 10));
|
||||
e.guild_consent_id = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.is_rezzed = row[11] ? static_cast<uint8_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.is_buried = row[12] ? static_cast<int8_t>(atoi(row[12])) : 0;
|
||||
e.was_at_graveyard = row[13] ? static_cast<int8_t>(atoi(row[13])) : 0;
|
||||
e.is_locked = row[14] ? static_cast<int8_t>(atoi(row[14])) : 0;
|
||||
e.exp = row[15] ? static_cast<uint32_t>(strtoul(row[15], nullptr, 10)) : 0;
|
||||
e.size = row[16] ? static_cast<uint32_t>(strtoul(row[16], nullptr, 10)) : 0;
|
||||
e.level = row[17] ? static_cast<uint32_t>(strtoul(row[17], nullptr, 10)) : 0;
|
||||
e.race = row[18] ? static_cast<uint32_t>(strtoul(row[18], nullptr, 10)) : 0;
|
||||
e.gender = row[19] ? static_cast<uint32_t>(strtoul(row[19], nullptr, 10)) : 0;
|
||||
e.class_ = row[20] ? static_cast<uint32_t>(strtoul(row[20], nullptr, 10)) : 0;
|
||||
e.deity = row[21] ? static_cast<uint32_t>(strtoul(row[21], nullptr, 10)) : 0;
|
||||
e.texture = row[22] ? static_cast<uint32_t>(strtoul(row[22], nullptr, 10)) : 0;
|
||||
e.helm_texture = row[23] ? static_cast<uint32_t>(strtoul(row[23], nullptr, 10)) : 0;
|
||||
e.copper = row[24] ? static_cast<uint32_t>(strtoul(row[24], nullptr, 10)) : 0;
|
||||
e.silver = row[25] ? static_cast<uint32_t>(strtoul(row[25], nullptr, 10)) : 0;
|
||||
e.gold = row[26] ? static_cast<uint32_t>(strtoul(row[26], nullptr, 10)) : 0;
|
||||
e.platinum = row[27] ? static_cast<uint32_t>(strtoul(row[27], nullptr, 10)) : 0;
|
||||
e.hair_color = row[28] ? static_cast<uint32_t>(strtoul(row[28], nullptr, 10)) : 0;
|
||||
e.beard_color = row[29] ? static_cast<uint32_t>(strtoul(row[29], nullptr, 10)) : 0;
|
||||
e.eye_color_1 = row[30] ? static_cast<uint32_t>(strtoul(row[30], nullptr, 10)) : 0;
|
||||
e.eye_color_2 = row[31] ? static_cast<uint32_t>(strtoul(row[31], nullptr, 10)) : 0;
|
||||
e.hair_style = row[32] ? static_cast<uint32_t>(strtoul(row[32], nullptr, 10)) : 0;
|
||||
e.face = row[33] ? static_cast<uint32_t>(strtoul(row[33], nullptr, 10)) : 0;
|
||||
e.beard = row[34] ? static_cast<uint32_t>(strtoul(row[34], nullptr, 10)) : 0;
|
||||
e.drakkin_heritage = row[35] ? static_cast<uint32_t>(strtoul(row[35], nullptr, 10)) : 0;
|
||||
e.drakkin_tattoo = row[36] ? static_cast<uint32_t>(strtoul(row[36], nullptr, 10)) : 0;
|
||||
e.drakkin_details = row[37] ? static_cast<uint32_t>(strtoul(row[37], nullptr, 10)) : 0;
|
||||
e.wc_1 = row[38] ? static_cast<uint32_t>(strtoul(row[38], nullptr, 10)) : 0;
|
||||
e.wc_2 = row[39] ? static_cast<uint32_t>(strtoul(row[39], nullptr, 10)) : 0;
|
||||
e.wc_3 = row[40] ? static_cast<uint32_t>(strtoul(row[40], nullptr, 10)) : 0;
|
||||
e.wc_4 = row[41] ? static_cast<uint32_t>(strtoul(row[41], nullptr, 10)) : 0;
|
||||
e.wc_5 = row[42] ? static_cast<uint32_t>(strtoul(row[42], nullptr, 10)) : 0;
|
||||
e.wc_6 = row[43] ? static_cast<uint32_t>(strtoul(row[43], nullptr, 10)) : 0;
|
||||
e.wc_7 = row[44] ? static_cast<uint32_t>(strtoul(row[44], nullptr, 10)) : 0;
|
||||
e.wc_8 = row[45] ? static_cast<uint32_t>(strtoul(row[45], nullptr, 10)) : 0;
|
||||
e.wc_9 = row[46] ? static_cast<uint32_t>(strtoul(row[46], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -672,53 +673,53 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterCorpses e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.charid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.charid = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.charname = row[2] ? row[2] : "";
|
||||
e.zone_id = static_cast<int16_t>(atoi(row[3]));
|
||||
e.instance_id = static_cast<uint16_t>(strtoul(row[4], nullptr, 10));
|
||||
e.x = strtof(row[5], nullptr);
|
||||
e.y = strtof(row[6], nullptr);
|
||||
e.z = strtof(row[7], nullptr);
|
||||
e.heading = strtof(row[8], nullptr);
|
||||
e.zone_id = row[3] ? static_cast<int16_t>(atoi(row[3])) : 0;
|
||||
e.instance_id = row[4] ? static_cast<uint16_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.x = row[5] ? strtof(row[5], nullptr) : 0;
|
||||
e.y = row[6] ? strtof(row[6], nullptr) : 0;
|
||||
e.z = row[7] ? strtof(row[7], nullptr) : 0;
|
||||
e.heading = row[8] ? strtof(row[8], nullptr) : 0;
|
||||
e.time_of_death = strtoll(row[9] ? row[9] : "-1", nullptr, 10);
|
||||
e.guild_consent_id = static_cast<uint32_t>(strtoul(row[10], nullptr, 10));
|
||||
e.is_rezzed = static_cast<uint8_t>(strtoul(row[11], nullptr, 10));
|
||||
e.is_buried = static_cast<int8_t>(atoi(row[12]));
|
||||
e.was_at_graveyard = static_cast<int8_t>(atoi(row[13]));
|
||||
e.is_locked = static_cast<int8_t>(atoi(row[14]));
|
||||
e.exp = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
||||
e.size = static_cast<uint32_t>(strtoul(row[16], nullptr, 10));
|
||||
e.level = static_cast<uint32_t>(strtoul(row[17], nullptr, 10));
|
||||
e.race = static_cast<uint32_t>(strtoul(row[18], nullptr, 10));
|
||||
e.gender = static_cast<uint32_t>(strtoul(row[19], nullptr, 10));
|
||||
e.class_ = static_cast<uint32_t>(strtoul(row[20], nullptr, 10));
|
||||
e.deity = static_cast<uint32_t>(strtoul(row[21], nullptr, 10));
|
||||
e.texture = static_cast<uint32_t>(strtoul(row[22], nullptr, 10));
|
||||
e.helm_texture = static_cast<uint32_t>(strtoul(row[23], nullptr, 10));
|
||||
e.copper = static_cast<uint32_t>(strtoul(row[24], nullptr, 10));
|
||||
e.silver = static_cast<uint32_t>(strtoul(row[25], nullptr, 10));
|
||||
e.gold = static_cast<uint32_t>(strtoul(row[26], nullptr, 10));
|
||||
e.platinum = static_cast<uint32_t>(strtoul(row[27], nullptr, 10));
|
||||
e.hair_color = static_cast<uint32_t>(strtoul(row[28], nullptr, 10));
|
||||
e.beard_color = static_cast<uint32_t>(strtoul(row[29], nullptr, 10));
|
||||
e.eye_color_1 = static_cast<uint32_t>(strtoul(row[30], nullptr, 10));
|
||||
e.eye_color_2 = static_cast<uint32_t>(strtoul(row[31], nullptr, 10));
|
||||
e.hair_style = static_cast<uint32_t>(strtoul(row[32], nullptr, 10));
|
||||
e.face = static_cast<uint32_t>(strtoul(row[33], nullptr, 10));
|
||||
e.beard = static_cast<uint32_t>(strtoul(row[34], nullptr, 10));
|
||||
e.drakkin_heritage = static_cast<uint32_t>(strtoul(row[35], nullptr, 10));
|
||||
e.drakkin_tattoo = static_cast<uint32_t>(strtoul(row[36], nullptr, 10));
|
||||
e.drakkin_details = static_cast<uint32_t>(strtoul(row[37], nullptr, 10));
|
||||
e.wc_1 = static_cast<uint32_t>(strtoul(row[38], nullptr, 10));
|
||||
e.wc_2 = static_cast<uint32_t>(strtoul(row[39], nullptr, 10));
|
||||
e.wc_3 = static_cast<uint32_t>(strtoul(row[40], nullptr, 10));
|
||||
e.wc_4 = static_cast<uint32_t>(strtoul(row[41], nullptr, 10));
|
||||
e.wc_5 = static_cast<uint32_t>(strtoul(row[42], nullptr, 10));
|
||||
e.wc_6 = static_cast<uint32_t>(strtoul(row[43], nullptr, 10));
|
||||
e.wc_7 = static_cast<uint32_t>(strtoul(row[44], nullptr, 10));
|
||||
e.wc_8 = static_cast<uint32_t>(strtoul(row[45], nullptr, 10));
|
||||
e.wc_9 = static_cast<uint32_t>(strtoul(row[46], nullptr, 10));
|
||||
e.guild_consent_id = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.is_rezzed = row[11] ? static_cast<uint8_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.is_buried = row[12] ? static_cast<int8_t>(atoi(row[12])) : 0;
|
||||
e.was_at_graveyard = row[13] ? static_cast<int8_t>(atoi(row[13])) : 0;
|
||||
e.is_locked = row[14] ? static_cast<int8_t>(atoi(row[14])) : 0;
|
||||
e.exp = row[15] ? static_cast<uint32_t>(strtoul(row[15], nullptr, 10)) : 0;
|
||||
e.size = row[16] ? static_cast<uint32_t>(strtoul(row[16], nullptr, 10)) : 0;
|
||||
e.level = row[17] ? static_cast<uint32_t>(strtoul(row[17], nullptr, 10)) : 0;
|
||||
e.race = row[18] ? static_cast<uint32_t>(strtoul(row[18], nullptr, 10)) : 0;
|
||||
e.gender = row[19] ? static_cast<uint32_t>(strtoul(row[19], nullptr, 10)) : 0;
|
||||
e.class_ = row[20] ? static_cast<uint32_t>(strtoul(row[20], nullptr, 10)) : 0;
|
||||
e.deity = row[21] ? static_cast<uint32_t>(strtoul(row[21], nullptr, 10)) : 0;
|
||||
e.texture = row[22] ? static_cast<uint32_t>(strtoul(row[22], nullptr, 10)) : 0;
|
||||
e.helm_texture = row[23] ? static_cast<uint32_t>(strtoul(row[23], nullptr, 10)) : 0;
|
||||
e.copper = row[24] ? static_cast<uint32_t>(strtoul(row[24], nullptr, 10)) : 0;
|
||||
e.silver = row[25] ? static_cast<uint32_t>(strtoul(row[25], nullptr, 10)) : 0;
|
||||
e.gold = row[26] ? static_cast<uint32_t>(strtoul(row[26], nullptr, 10)) : 0;
|
||||
e.platinum = row[27] ? static_cast<uint32_t>(strtoul(row[27], nullptr, 10)) : 0;
|
||||
e.hair_color = row[28] ? static_cast<uint32_t>(strtoul(row[28], nullptr, 10)) : 0;
|
||||
e.beard_color = row[29] ? static_cast<uint32_t>(strtoul(row[29], nullptr, 10)) : 0;
|
||||
e.eye_color_1 = row[30] ? static_cast<uint32_t>(strtoul(row[30], nullptr, 10)) : 0;
|
||||
e.eye_color_2 = row[31] ? static_cast<uint32_t>(strtoul(row[31], nullptr, 10)) : 0;
|
||||
e.hair_style = row[32] ? static_cast<uint32_t>(strtoul(row[32], nullptr, 10)) : 0;
|
||||
e.face = row[33] ? static_cast<uint32_t>(strtoul(row[33], nullptr, 10)) : 0;
|
||||
e.beard = row[34] ? static_cast<uint32_t>(strtoul(row[34], nullptr, 10)) : 0;
|
||||
e.drakkin_heritage = row[35] ? static_cast<uint32_t>(strtoul(row[35], nullptr, 10)) : 0;
|
||||
e.drakkin_tattoo = row[36] ? static_cast<uint32_t>(strtoul(row[36], nullptr, 10)) : 0;
|
||||
e.drakkin_details = row[37] ? static_cast<uint32_t>(strtoul(row[37], nullptr, 10)) : 0;
|
||||
e.wc_1 = row[38] ? static_cast<uint32_t>(strtoul(row[38], nullptr, 10)) : 0;
|
||||
e.wc_2 = row[39] ? static_cast<uint32_t>(strtoul(row[39], nullptr, 10)) : 0;
|
||||
e.wc_3 = row[40] ? static_cast<uint32_t>(strtoul(row[40], nullptr, 10)) : 0;
|
||||
e.wc_4 = row[41] ? static_cast<uint32_t>(strtoul(row[41], nullptr, 10)) : 0;
|
||||
e.wc_5 = row[42] ? static_cast<uint32_t>(strtoul(row[42], nullptr, 10)) : 0;
|
||||
e.wc_6 = row[43] ? static_cast<uint32_t>(strtoul(row[43], nullptr, 10)) : 0;
|
||||
e.wc_7 = row[44] ? static_cast<uint32_t>(strtoul(row[44], nullptr, 10)) : 0;
|
||||
e.wc_8 = row[45] ? static_cast<uint32_t>(strtoul(row[45], nullptr, 10)) : 0;
|
||||
e.wc_9 = row[46] ? static_cast<uint32_t>(strtoul(row[46], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -777,6 +778,154 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterCorpses &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.charid));
|
||||
v.push_back("'" + Strings::Escape(e.charname) + "'");
|
||||
v.push_back(std::to_string(e.zone_id));
|
||||
v.push_back(std::to_string(e.instance_id));
|
||||
v.push_back(std::to_string(e.x));
|
||||
v.push_back(std::to_string(e.y));
|
||||
v.push_back(std::to_string(e.z));
|
||||
v.push_back(std::to_string(e.heading));
|
||||
v.push_back("FROM_UNIXTIME(" + (e.time_of_death > 0 ? std::to_string(e.time_of_death) : "null") + ")");
|
||||
v.push_back(std::to_string(e.guild_consent_id));
|
||||
v.push_back(std::to_string(e.is_rezzed));
|
||||
v.push_back(std::to_string(e.is_buried));
|
||||
v.push_back(std::to_string(e.was_at_graveyard));
|
||||
v.push_back(std::to_string(e.is_locked));
|
||||
v.push_back(std::to_string(e.exp));
|
||||
v.push_back(std::to_string(e.size));
|
||||
v.push_back(std::to_string(e.level));
|
||||
v.push_back(std::to_string(e.race));
|
||||
v.push_back(std::to_string(e.gender));
|
||||
v.push_back(std::to_string(e.class_));
|
||||
v.push_back(std::to_string(e.deity));
|
||||
v.push_back(std::to_string(e.texture));
|
||||
v.push_back(std::to_string(e.helm_texture));
|
||||
v.push_back(std::to_string(e.copper));
|
||||
v.push_back(std::to_string(e.silver));
|
||||
v.push_back(std::to_string(e.gold));
|
||||
v.push_back(std::to_string(e.platinum));
|
||||
v.push_back(std::to_string(e.hair_color));
|
||||
v.push_back(std::to_string(e.beard_color));
|
||||
v.push_back(std::to_string(e.eye_color_1));
|
||||
v.push_back(std::to_string(e.eye_color_2));
|
||||
v.push_back(std::to_string(e.hair_style));
|
||||
v.push_back(std::to_string(e.face));
|
||||
v.push_back(std::to_string(e.beard));
|
||||
v.push_back(std::to_string(e.drakkin_heritage));
|
||||
v.push_back(std::to_string(e.drakkin_tattoo));
|
||||
v.push_back(std::to_string(e.drakkin_details));
|
||||
v.push_back(std::to_string(e.wc_1));
|
||||
v.push_back(std::to_string(e.wc_2));
|
||||
v.push_back(std::to_string(e.wc_3));
|
||||
v.push_back(std::to_string(e.wc_4));
|
||||
v.push_back(std::to_string(e.wc_5));
|
||||
v.push_back(std::to_string(e.wc_6));
|
||||
v.push_back(std::to_string(e.wc_7));
|
||||
v.push_back(std::to_string(e.wc_8));
|
||||
v.push_back(std::to_string(e.wc_9));
|
||||
|
||||
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<CharacterCorpses> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.charid));
|
||||
v.push_back("'" + Strings::Escape(e.charname) + "'");
|
||||
v.push_back(std::to_string(e.zone_id));
|
||||
v.push_back(std::to_string(e.instance_id));
|
||||
v.push_back(std::to_string(e.x));
|
||||
v.push_back(std::to_string(e.y));
|
||||
v.push_back(std::to_string(e.z));
|
||||
v.push_back(std::to_string(e.heading));
|
||||
v.push_back("FROM_UNIXTIME(" + (e.time_of_death > 0 ? std::to_string(e.time_of_death) : "null") + ")");
|
||||
v.push_back(std::to_string(e.guild_consent_id));
|
||||
v.push_back(std::to_string(e.is_rezzed));
|
||||
v.push_back(std::to_string(e.is_buried));
|
||||
v.push_back(std::to_string(e.was_at_graveyard));
|
||||
v.push_back(std::to_string(e.is_locked));
|
||||
v.push_back(std::to_string(e.exp));
|
||||
v.push_back(std::to_string(e.size));
|
||||
v.push_back(std::to_string(e.level));
|
||||
v.push_back(std::to_string(e.race));
|
||||
v.push_back(std::to_string(e.gender));
|
||||
v.push_back(std::to_string(e.class_));
|
||||
v.push_back(std::to_string(e.deity));
|
||||
v.push_back(std::to_string(e.texture));
|
||||
v.push_back(std::to_string(e.helm_texture));
|
||||
v.push_back(std::to_string(e.copper));
|
||||
v.push_back(std::to_string(e.silver));
|
||||
v.push_back(std::to_string(e.gold));
|
||||
v.push_back(std::to_string(e.platinum));
|
||||
v.push_back(std::to_string(e.hair_color));
|
||||
v.push_back(std::to_string(e.beard_color));
|
||||
v.push_back(std::to_string(e.eye_color_1));
|
||||
v.push_back(std::to_string(e.eye_color_2));
|
||||
v.push_back(std::to_string(e.hair_style));
|
||||
v.push_back(std::to_string(e.face));
|
||||
v.push_back(std::to_string(e.beard));
|
||||
v.push_back(std::to_string(e.drakkin_heritage));
|
||||
v.push_back(std::to_string(e.drakkin_tattoo));
|
||||
v.push_back(std::to_string(e.drakkin_details));
|
||||
v.push_back(std::to_string(e.wc_1));
|
||||
v.push_back(std::to_string(e.wc_2));
|
||||
v.push_back(std::to_string(e.wc_3));
|
||||
v.push_back(std::to_string(e.wc_4));
|
||||
v.push_back(std::to_string(e.wc_5));
|
||||
v.push_back(std::to_string(e.wc_6));
|
||||
v.push_back(std::to_string(e.wc_7));
|
||||
v.push_back(std::to_string(e.wc_8));
|
||||
v.push_back(std::to_string(e.wc_9));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_CORPSES_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_CURRENCY_REPOSITORY_H
|
||||
@@ -168,8 +168,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_currency_id
|
||||
)
|
||||
);
|
||||
@@ -178,23 +179,23 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterCurrency e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.platinum = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.gold = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.silver = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.copper = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.platinum_bank = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.gold_bank = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.silver_bank = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.copper_bank = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.platinum_cursor = static_cast<uint32_t>(strtoul(row[9], nullptr, 10));
|
||||
e.gold_cursor = static_cast<uint32_t>(strtoul(row[10], nullptr, 10));
|
||||
e.silver_cursor = static_cast<uint32_t>(strtoul(row[11], nullptr, 10));
|
||||
e.copper_cursor = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
||||
e.radiant_crystals = static_cast<uint32_t>(strtoul(row[13], nullptr, 10));
|
||||
e.career_radiant_crystals = static_cast<uint32_t>(strtoul(row[14], nullptr, 10));
|
||||
e.ebon_crystals = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
||||
e.career_ebon_crystals = static_cast<uint32_t>(strtoul(row[16], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.platinum = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.gold = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.silver = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.copper = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.platinum_bank = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.gold_bank = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.silver_bank = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.copper_bank = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.platinum_cursor = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.gold_cursor = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.silver_cursor = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.copper_cursor = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.radiant_crystals = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.career_radiant_crystals = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||
e.ebon_crystals = row[15] ? static_cast<uint32_t>(strtoul(row[15], nullptr, 10)) : 0;
|
||||
e.career_ebon_crystals = row[16] ? static_cast<uint32_t>(strtoul(row[16], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -362,23 +363,23 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterCurrency e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.platinum = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.gold = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.silver = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.copper = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.platinum_bank = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.gold_bank = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.silver_bank = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.copper_bank = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.platinum_cursor = static_cast<uint32_t>(strtoul(row[9], nullptr, 10));
|
||||
e.gold_cursor = static_cast<uint32_t>(strtoul(row[10], nullptr, 10));
|
||||
e.silver_cursor = static_cast<uint32_t>(strtoul(row[11], nullptr, 10));
|
||||
e.copper_cursor = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
||||
e.radiant_crystals = static_cast<uint32_t>(strtoul(row[13], nullptr, 10));
|
||||
e.career_radiant_crystals = static_cast<uint32_t>(strtoul(row[14], nullptr, 10));
|
||||
e.ebon_crystals = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
||||
e.career_ebon_crystals = static_cast<uint32_t>(strtoul(row[16], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.platinum = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.gold = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.silver = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.copper = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.platinum_bank = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.gold_bank = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.silver_bank = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.copper_bank = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.platinum_cursor = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.gold_cursor = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.silver_cursor = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.copper_cursor = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.radiant_crystals = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.career_radiant_crystals = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||
e.ebon_crystals = row[15] ? static_cast<uint32_t>(strtoul(row[15], nullptr, 10)) : 0;
|
||||
e.career_ebon_crystals = row[16] ? static_cast<uint32_t>(strtoul(row[16], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -403,23 +404,23 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterCurrency e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.platinum = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.gold = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.silver = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.copper = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.platinum_bank = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.gold_bank = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.silver_bank = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.copper_bank = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.platinum_cursor = static_cast<uint32_t>(strtoul(row[9], nullptr, 10));
|
||||
e.gold_cursor = static_cast<uint32_t>(strtoul(row[10], nullptr, 10));
|
||||
e.silver_cursor = static_cast<uint32_t>(strtoul(row[11], nullptr, 10));
|
||||
e.copper_cursor = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
||||
e.radiant_crystals = static_cast<uint32_t>(strtoul(row[13], nullptr, 10));
|
||||
e.career_radiant_crystals = static_cast<uint32_t>(strtoul(row[14], nullptr, 10));
|
||||
e.ebon_crystals = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
||||
e.career_ebon_crystals = static_cast<uint32_t>(strtoul(row[16], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.platinum = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.gold = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.silver = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.copper = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.platinum_bank = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.gold_bank = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.silver_bank = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.copper_bank = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.platinum_cursor = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.gold_cursor = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.silver_cursor = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.copper_cursor = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.radiant_crystals = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.career_radiant_crystals = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||
e.ebon_crystals = row[15] ? static_cast<uint32_t>(strtoul(row[15], nullptr, 10)) : 0;
|
||||
e.career_ebon_crystals = row[16] ? static_cast<uint32_t>(strtoul(row[16], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -478,6 +479,94 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterCurrency &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.platinum));
|
||||
v.push_back(std::to_string(e.gold));
|
||||
v.push_back(std::to_string(e.silver));
|
||||
v.push_back(std::to_string(e.copper));
|
||||
v.push_back(std::to_string(e.platinum_bank));
|
||||
v.push_back(std::to_string(e.gold_bank));
|
||||
v.push_back(std::to_string(e.silver_bank));
|
||||
v.push_back(std::to_string(e.copper_bank));
|
||||
v.push_back(std::to_string(e.platinum_cursor));
|
||||
v.push_back(std::to_string(e.gold_cursor));
|
||||
v.push_back(std::to_string(e.silver_cursor));
|
||||
v.push_back(std::to_string(e.copper_cursor));
|
||||
v.push_back(std::to_string(e.radiant_crystals));
|
||||
v.push_back(std::to_string(e.career_radiant_crystals));
|
||||
v.push_back(std::to_string(e.ebon_crystals));
|
||||
v.push_back(std::to_string(e.career_ebon_crystals));
|
||||
|
||||
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<CharacterCurrency> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.platinum));
|
||||
v.push_back(std::to_string(e.gold));
|
||||
v.push_back(std::to_string(e.silver));
|
||||
v.push_back(std::to_string(e.copper));
|
||||
v.push_back(std::to_string(e.platinum_bank));
|
||||
v.push_back(std::to_string(e.gold_bank));
|
||||
v.push_back(std::to_string(e.silver_bank));
|
||||
v.push_back(std::to_string(e.copper_bank));
|
||||
v.push_back(std::to_string(e.platinum_cursor));
|
||||
v.push_back(std::to_string(e.gold_cursor));
|
||||
v.push_back(std::to_string(e.silver_cursor));
|
||||
v.push_back(std::to_string(e.copper_cursor));
|
||||
v.push_back(std::to_string(e.radiant_crystals));
|
||||
v.push_back(std::to_string(e.career_radiant_crystals));
|
||||
v.push_back(std::to_string(e.ebon_crystals));
|
||||
v.push_back(std::to_string(e.career_ebon_crystals));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_CURRENCY_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_DATA_REPOSITORY_H
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
class BaseCharacterDataRepository {
|
||||
public:
|
||||
struct CharacterData {
|
||||
@@ -524,108 +523,108 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterData e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.account_id = static_cast<int32_t>(atoi(row[1]));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.account_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.name = row[2] ? row[2] : "";
|
||||
e.last_name = row[3] ? row[3] : "";
|
||||
e.title = row[4] ? row[4] : "";
|
||||
e.suffix = row[5] ? row[5] : "";
|
||||
e.zone_id = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.zone_instance = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.y = strtof(row[8], nullptr);
|
||||
e.x = strtof(row[9], nullptr);
|
||||
e.z = strtof(row[10], nullptr);
|
||||
e.heading = strtof(row[11], nullptr);
|
||||
e.gender = static_cast<uint8_t>(strtoul(row[12], nullptr, 10));
|
||||
e.race = static_cast<uint16_t>(strtoul(row[13], nullptr, 10));
|
||||
e.class_ = static_cast<uint8_t>(strtoul(row[14], nullptr, 10));
|
||||
e.level = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
||||
e.deity = static_cast<uint32_t>(strtoul(row[16], nullptr, 10));
|
||||
e.birthday = static_cast<uint32_t>(strtoul(row[17], nullptr, 10));
|
||||
e.last_login = static_cast<uint32_t>(strtoul(row[18], nullptr, 10));
|
||||
e.time_played = static_cast<uint32_t>(strtoul(row[19], nullptr, 10));
|
||||
e.level2 = static_cast<uint8_t>(strtoul(row[20], nullptr, 10));
|
||||
e.anon = static_cast<uint8_t>(strtoul(row[21], nullptr, 10));
|
||||
e.gm = static_cast<uint8_t>(strtoul(row[22], nullptr, 10));
|
||||
e.face = static_cast<uint32_t>(strtoul(row[23], nullptr, 10));
|
||||
e.hair_color = static_cast<uint8_t>(strtoul(row[24], nullptr, 10));
|
||||
e.hair_style = static_cast<uint8_t>(strtoul(row[25], nullptr, 10));
|
||||
e.beard = static_cast<uint8_t>(strtoul(row[26], nullptr, 10));
|
||||
e.beard_color = static_cast<uint8_t>(strtoul(row[27], nullptr, 10));
|
||||
e.eye_color_1 = static_cast<uint8_t>(strtoul(row[28], nullptr, 10));
|
||||
e.eye_color_2 = static_cast<uint8_t>(strtoul(row[29], nullptr, 10));
|
||||
e.drakkin_heritage = static_cast<uint32_t>(strtoul(row[30], nullptr, 10));
|
||||
e.drakkin_tattoo = static_cast<uint32_t>(strtoul(row[31], nullptr, 10));
|
||||
e.drakkin_details = static_cast<uint32_t>(strtoul(row[32], nullptr, 10));
|
||||
e.ability_time_seconds = static_cast<uint8_t>(strtoul(row[33], nullptr, 10));
|
||||
e.ability_number = static_cast<uint8_t>(strtoul(row[34], nullptr, 10));
|
||||
e.ability_time_minutes = static_cast<uint8_t>(strtoul(row[35], nullptr, 10));
|
||||
e.ability_time_hours = static_cast<uint8_t>(strtoul(row[36], nullptr, 10));
|
||||
e.exp = static_cast<uint32_t>(strtoul(row[37], nullptr, 10));
|
||||
e.exp_enabled = static_cast<uint8_t>(strtoul(row[38], nullptr, 10));
|
||||
e.aa_points_spent = static_cast<uint32_t>(strtoul(row[39], nullptr, 10));
|
||||
e.aa_exp = static_cast<uint32_t>(strtoul(row[40], nullptr, 10));
|
||||
e.aa_points = static_cast<uint32_t>(strtoul(row[41], nullptr, 10));
|
||||
e.group_leadership_exp = static_cast<uint32_t>(strtoul(row[42], nullptr, 10));
|
||||
e.raid_leadership_exp = static_cast<uint32_t>(strtoul(row[43], nullptr, 10));
|
||||
e.group_leadership_points = static_cast<uint32_t>(strtoul(row[44], nullptr, 10));
|
||||
e.raid_leadership_points = static_cast<uint32_t>(strtoul(row[45], nullptr, 10));
|
||||
e.points = static_cast<uint32_t>(strtoul(row[46], nullptr, 10));
|
||||
e.cur_hp = static_cast<uint32_t>(strtoul(row[47], nullptr, 10));
|
||||
e.mana = static_cast<uint32_t>(strtoul(row[48], nullptr, 10));
|
||||
e.endurance = static_cast<uint32_t>(strtoul(row[49], nullptr, 10));
|
||||
e.intoxication = static_cast<uint32_t>(strtoul(row[50], nullptr, 10));
|
||||
e.str = static_cast<uint32_t>(strtoul(row[51], nullptr, 10));
|
||||
e.sta = static_cast<uint32_t>(strtoul(row[52], nullptr, 10));
|
||||
e.cha = static_cast<uint32_t>(strtoul(row[53], nullptr, 10));
|
||||
e.dex = static_cast<uint32_t>(strtoul(row[54], nullptr, 10));
|
||||
e.int_ = static_cast<uint32_t>(strtoul(row[55], nullptr, 10));
|
||||
e.agi = static_cast<uint32_t>(strtoul(row[56], nullptr, 10));
|
||||
e.wis = static_cast<uint32_t>(strtoul(row[57], nullptr, 10));
|
||||
e.zone_change_count = static_cast<uint32_t>(strtoul(row[58], nullptr, 10));
|
||||
e.toxicity = static_cast<uint32_t>(strtoul(row[59], nullptr, 10));
|
||||
e.hunger_level = static_cast<uint32_t>(strtoul(row[60], nullptr, 10));
|
||||
e.thirst_level = static_cast<uint32_t>(strtoul(row[61], nullptr, 10));
|
||||
e.ability_up = static_cast<uint32_t>(strtoul(row[62], nullptr, 10));
|
||||
e.ldon_points_guk = static_cast<uint32_t>(strtoul(row[63], nullptr, 10));
|
||||
e.ldon_points_mir = static_cast<uint32_t>(strtoul(row[64], nullptr, 10));
|
||||
e.ldon_points_mmc = static_cast<uint32_t>(strtoul(row[65], nullptr, 10));
|
||||
e.ldon_points_ruj = static_cast<uint32_t>(strtoul(row[66], nullptr, 10));
|
||||
e.ldon_points_tak = static_cast<uint32_t>(strtoul(row[67], nullptr, 10));
|
||||
e.ldon_points_available = static_cast<uint32_t>(strtoul(row[68], nullptr, 10));
|
||||
e.tribute_time_remaining = static_cast<uint32_t>(strtoul(row[69], nullptr, 10));
|
||||
e.career_tribute_points = static_cast<uint32_t>(strtoul(row[70], nullptr, 10));
|
||||
e.tribute_points = static_cast<uint32_t>(strtoul(row[71], nullptr, 10));
|
||||
e.tribute_active = static_cast<uint32_t>(strtoul(row[72], nullptr, 10));
|
||||
e.pvp_status = static_cast<uint8_t>(strtoul(row[73], nullptr, 10));
|
||||
e.pvp_kills = static_cast<uint32_t>(strtoul(row[74], nullptr, 10));
|
||||
e.pvp_deaths = static_cast<uint32_t>(strtoul(row[75], nullptr, 10));
|
||||
e.pvp_current_points = static_cast<uint32_t>(strtoul(row[76], nullptr, 10));
|
||||
e.pvp_career_points = static_cast<uint32_t>(strtoul(row[77], nullptr, 10));
|
||||
e.pvp_best_kill_streak = static_cast<uint32_t>(strtoul(row[78], nullptr, 10));
|
||||
e.pvp_worst_death_streak = static_cast<uint32_t>(strtoul(row[79], nullptr, 10));
|
||||
e.pvp_current_kill_streak = static_cast<uint32_t>(strtoul(row[80], nullptr, 10));
|
||||
e.pvp2 = static_cast<uint32_t>(strtoul(row[81], nullptr, 10));
|
||||
e.pvp_type = static_cast<uint32_t>(strtoul(row[82], nullptr, 10));
|
||||
e.show_helm = static_cast<uint32_t>(strtoul(row[83], nullptr, 10));
|
||||
e.group_auto_consent = static_cast<uint8_t>(strtoul(row[84], nullptr, 10));
|
||||
e.raid_auto_consent = static_cast<uint8_t>(strtoul(row[85], nullptr, 10));
|
||||
e.guild_auto_consent = static_cast<uint8_t>(strtoul(row[86], nullptr, 10));
|
||||
e.leadership_exp_on = static_cast<uint8_t>(strtoul(row[87], nullptr, 10));
|
||||
e.RestTimer = static_cast<uint32_t>(strtoul(row[88], nullptr, 10));
|
||||
e.air_remaining = static_cast<uint32_t>(strtoul(row[89], nullptr, 10));
|
||||
e.autosplit_enabled = static_cast<uint32_t>(strtoul(row[90], nullptr, 10));
|
||||
e.lfp = static_cast<uint8_t>(strtoul(row[91], nullptr, 10));
|
||||
e.lfg = static_cast<uint8_t>(strtoul(row[92], nullptr, 10));
|
||||
e.zone_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.zone_instance = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.y = row[8] ? strtof(row[8], nullptr) : 0;
|
||||
e.x = row[9] ? strtof(row[9], nullptr) : 0;
|
||||
e.z = row[10] ? strtof(row[10], nullptr) : 0;
|
||||
e.heading = row[11] ? strtof(row[11], nullptr) : 0;
|
||||
e.gender = row[12] ? static_cast<uint8_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.race = row[13] ? static_cast<uint16_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.class_ = row[14] ? static_cast<uint8_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||
e.level = row[15] ? static_cast<uint32_t>(strtoul(row[15], nullptr, 10)) : 0;
|
||||
e.deity = row[16] ? static_cast<uint32_t>(strtoul(row[16], nullptr, 10)) : 0;
|
||||
e.birthday = row[17] ? static_cast<uint32_t>(strtoul(row[17], nullptr, 10)) : 0;
|
||||
e.last_login = row[18] ? static_cast<uint32_t>(strtoul(row[18], nullptr, 10)) : 0;
|
||||
e.time_played = row[19] ? static_cast<uint32_t>(strtoul(row[19], nullptr, 10)) : 0;
|
||||
e.level2 = row[20] ? static_cast<uint8_t>(strtoul(row[20], nullptr, 10)) : 0;
|
||||
e.anon = row[21] ? static_cast<uint8_t>(strtoul(row[21], nullptr, 10)) : 0;
|
||||
e.gm = row[22] ? static_cast<uint8_t>(strtoul(row[22], nullptr, 10)) : 0;
|
||||
e.face = row[23] ? static_cast<uint32_t>(strtoul(row[23], nullptr, 10)) : 0;
|
||||
e.hair_color = row[24] ? static_cast<uint8_t>(strtoul(row[24], nullptr, 10)) : 0;
|
||||
e.hair_style = row[25] ? static_cast<uint8_t>(strtoul(row[25], nullptr, 10)) : 0;
|
||||
e.beard = row[26] ? static_cast<uint8_t>(strtoul(row[26], nullptr, 10)) : 0;
|
||||
e.beard_color = row[27] ? static_cast<uint8_t>(strtoul(row[27], nullptr, 10)) : 0;
|
||||
e.eye_color_1 = row[28] ? static_cast<uint8_t>(strtoul(row[28], nullptr, 10)) : 0;
|
||||
e.eye_color_2 = row[29] ? static_cast<uint8_t>(strtoul(row[29], nullptr, 10)) : 0;
|
||||
e.drakkin_heritage = row[30] ? static_cast<uint32_t>(strtoul(row[30], nullptr, 10)) : 0;
|
||||
e.drakkin_tattoo = row[31] ? static_cast<uint32_t>(strtoul(row[31], nullptr, 10)) : 0;
|
||||
e.drakkin_details = row[32] ? static_cast<uint32_t>(strtoul(row[32], nullptr, 10)) : 0;
|
||||
e.ability_time_seconds = row[33] ? static_cast<uint8_t>(strtoul(row[33], nullptr, 10)) : 0;
|
||||
e.ability_number = row[34] ? static_cast<uint8_t>(strtoul(row[34], nullptr, 10)) : 0;
|
||||
e.ability_time_minutes = row[35] ? static_cast<uint8_t>(strtoul(row[35], nullptr, 10)) : 0;
|
||||
e.ability_time_hours = row[36] ? static_cast<uint8_t>(strtoul(row[36], nullptr, 10)) : 0;
|
||||
e.exp = row[37] ? static_cast<uint32_t>(strtoul(row[37], nullptr, 10)) : 0;
|
||||
e.exp_enabled = row[38] ? static_cast<uint8_t>(strtoul(row[38], nullptr, 10)) : 1;
|
||||
e.aa_points_spent = row[39] ? static_cast<uint32_t>(strtoul(row[39], nullptr, 10)) : 0;
|
||||
e.aa_exp = row[40] ? static_cast<uint32_t>(strtoul(row[40], nullptr, 10)) : 0;
|
||||
e.aa_points = row[41] ? static_cast<uint32_t>(strtoul(row[41], nullptr, 10)) : 0;
|
||||
e.group_leadership_exp = row[42] ? static_cast<uint32_t>(strtoul(row[42], nullptr, 10)) : 0;
|
||||
e.raid_leadership_exp = row[43] ? static_cast<uint32_t>(strtoul(row[43], nullptr, 10)) : 0;
|
||||
e.group_leadership_points = row[44] ? static_cast<uint32_t>(strtoul(row[44], nullptr, 10)) : 0;
|
||||
e.raid_leadership_points = row[45] ? static_cast<uint32_t>(strtoul(row[45], nullptr, 10)) : 0;
|
||||
e.points = row[46] ? static_cast<uint32_t>(strtoul(row[46], nullptr, 10)) : 0;
|
||||
e.cur_hp = row[47] ? static_cast<uint32_t>(strtoul(row[47], nullptr, 10)) : 0;
|
||||
e.mana = row[48] ? static_cast<uint32_t>(strtoul(row[48], nullptr, 10)) : 0;
|
||||
e.endurance = row[49] ? static_cast<uint32_t>(strtoul(row[49], nullptr, 10)) : 0;
|
||||
e.intoxication = row[50] ? static_cast<uint32_t>(strtoul(row[50], nullptr, 10)) : 0;
|
||||
e.str = row[51] ? static_cast<uint32_t>(strtoul(row[51], nullptr, 10)) : 0;
|
||||
e.sta = row[52] ? static_cast<uint32_t>(strtoul(row[52], nullptr, 10)) : 0;
|
||||
e.cha = row[53] ? static_cast<uint32_t>(strtoul(row[53], nullptr, 10)) : 0;
|
||||
e.dex = row[54] ? static_cast<uint32_t>(strtoul(row[54], nullptr, 10)) : 0;
|
||||
e.int_ = row[55] ? static_cast<uint32_t>(strtoul(row[55], nullptr, 10)) : 0;
|
||||
e.agi = row[56] ? static_cast<uint32_t>(strtoul(row[56], nullptr, 10)) : 0;
|
||||
e.wis = row[57] ? static_cast<uint32_t>(strtoul(row[57], nullptr, 10)) : 0;
|
||||
e.zone_change_count = row[58] ? static_cast<uint32_t>(strtoul(row[58], nullptr, 10)) : 0;
|
||||
e.toxicity = row[59] ? static_cast<uint32_t>(strtoul(row[59], nullptr, 10)) : 0;
|
||||
e.hunger_level = row[60] ? static_cast<uint32_t>(strtoul(row[60], nullptr, 10)) : 0;
|
||||
e.thirst_level = row[61] ? static_cast<uint32_t>(strtoul(row[61], nullptr, 10)) : 0;
|
||||
e.ability_up = row[62] ? static_cast<uint32_t>(strtoul(row[62], nullptr, 10)) : 0;
|
||||
e.ldon_points_guk = row[63] ? static_cast<uint32_t>(strtoul(row[63], nullptr, 10)) : 0;
|
||||
e.ldon_points_mir = row[64] ? static_cast<uint32_t>(strtoul(row[64], nullptr, 10)) : 0;
|
||||
e.ldon_points_mmc = row[65] ? static_cast<uint32_t>(strtoul(row[65], nullptr, 10)) : 0;
|
||||
e.ldon_points_ruj = row[66] ? static_cast<uint32_t>(strtoul(row[66], nullptr, 10)) : 0;
|
||||
e.ldon_points_tak = row[67] ? static_cast<uint32_t>(strtoul(row[67], nullptr, 10)) : 0;
|
||||
e.ldon_points_available = row[68] ? static_cast<uint32_t>(strtoul(row[68], nullptr, 10)) : 0;
|
||||
e.tribute_time_remaining = row[69] ? static_cast<uint32_t>(strtoul(row[69], nullptr, 10)) : 0;
|
||||
e.career_tribute_points = row[70] ? static_cast<uint32_t>(strtoul(row[70], nullptr, 10)) : 0;
|
||||
e.tribute_points = row[71] ? static_cast<uint32_t>(strtoul(row[71], nullptr, 10)) : 0;
|
||||
e.tribute_active = row[72] ? static_cast<uint32_t>(strtoul(row[72], nullptr, 10)) : 0;
|
||||
e.pvp_status = row[73] ? static_cast<uint8_t>(strtoul(row[73], nullptr, 10)) : 0;
|
||||
e.pvp_kills = row[74] ? static_cast<uint32_t>(strtoul(row[74], nullptr, 10)) : 0;
|
||||
e.pvp_deaths = row[75] ? static_cast<uint32_t>(strtoul(row[75], nullptr, 10)) : 0;
|
||||
e.pvp_current_points = row[76] ? static_cast<uint32_t>(strtoul(row[76], nullptr, 10)) : 0;
|
||||
e.pvp_career_points = row[77] ? static_cast<uint32_t>(strtoul(row[77], nullptr, 10)) : 0;
|
||||
e.pvp_best_kill_streak = row[78] ? static_cast<uint32_t>(strtoul(row[78], nullptr, 10)) : 0;
|
||||
e.pvp_worst_death_streak = row[79] ? static_cast<uint32_t>(strtoul(row[79], nullptr, 10)) : 0;
|
||||
e.pvp_current_kill_streak = row[80] ? static_cast<uint32_t>(strtoul(row[80], nullptr, 10)) : 0;
|
||||
e.pvp2 = row[81] ? static_cast<uint32_t>(strtoul(row[81], nullptr, 10)) : 0;
|
||||
e.pvp_type = row[82] ? static_cast<uint32_t>(strtoul(row[82], nullptr, 10)) : 0;
|
||||
e.show_helm = row[83] ? static_cast<uint32_t>(strtoul(row[83], nullptr, 10)) : 0;
|
||||
e.group_auto_consent = row[84] ? static_cast<uint8_t>(strtoul(row[84], nullptr, 10)) : 0;
|
||||
e.raid_auto_consent = row[85] ? static_cast<uint8_t>(strtoul(row[85], nullptr, 10)) : 0;
|
||||
e.guild_auto_consent = row[86] ? static_cast<uint8_t>(strtoul(row[86], nullptr, 10)) : 0;
|
||||
e.leadership_exp_on = row[87] ? static_cast<uint8_t>(strtoul(row[87], nullptr, 10)) : 0;
|
||||
e.RestTimer = row[88] ? static_cast<uint32_t>(strtoul(row[88], nullptr, 10)) : 0;
|
||||
e.air_remaining = row[89] ? static_cast<uint32_t>(strtoul(row[89], nullptr, 10)) : 0;
|
||||
e.autosplit_enabled = row[90] ? static_cast<uint32_t>(strtoul(row[90], nullptr, 10)) : 0;
|
||||
e.lfp = row[91] ? static_cast<uint8_t>(strtoul(row[91], nullptr, 10)) : 0;
|
||||
e.lfg = row[92] ? static_cast<uint8_t>(strtoul(row[92], nullptr, 10)) : 0;
|
||||
e.mailkey = row[93] ? row[93] : "";
|
||||
e.xtargets = static_cast<uint8_t>(strtoul(row[94], nullptr, 10));
|
||||
e.firstlogon = static_cast<int8_t>(atoi(row[95]));
|
||||
e.e_aa_effects = static_cast<uint32_t>(strtoul(row[96], nullptr, 10));
|
||||
e.e_percent_to_aa = static_cast<uint32_t>(strtoul(row[97], nullptr, 10));
|
||||
e.e_expended_aa_spent = static_cast<uint32_t>(strtoul(row[98], nullptr, 10));
|
||||
e.aa_points_spent_old = static_cast<uint32_t>(strtoul(row[99], nullptr, 10));
|
||||
e.aa_points_old = static_cast<uint32_t>(strtoul(row[100], nullptr, 10));
|
||||
e.e_last_invsnapshot = static_cast<uint32_t>(strtoul(row[101], nullptr, 10));
|
||||
e.xtargets = row[94] ? static_cast<uint8_t>(strtoul(row[94], nullptr, 10)) : 5;
|
||||
e.firstlogon = row[95] ? static_cast<int8_t>(atoi(row[95])) : 0;
|
||||
e.e_aa_effects = row[96] ? static_cast<uint32_t>(strtoul(row[96], nullptr, 10)) : 0;
|
||||
e.e_percent_to_aa = row[97] ? static_cast<uint32_t>(strtoul(row[97], nullptr, 10)) : 0;
|
||||
e.e_expended_aa_spent = row[98] ? static_cast<uint32_t>(strtoul(row[98], nullptr, 10)) : 0;
|
||||
e.aa_points_spent_old = row[99] ? static_cast<uint32_t>(strtoul(row[99], nullptr, 10)) : 0;
|
||||
e.aa_points_old = row[100] ? static_cast<uint32_t>(strtoul(row[100], nullptr, 10)) : 0;
|
||||
e.e_last_invsnapshot = row[101] ? static_cast<uint32_t>(strtoul(row[101], nullptr, 10)) : 0;
|
||||
e.deleted_at = strtoll(row[102] ? row[102] : "-1", nullptr, 10);
|
||||
|
||||
return e;
|
||||
@@ -1051,108 +1050,108 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterData e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.account_id = static_cast<int32_t>(atoi(row[1]));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.account_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.name = row[2] ? row[2] : "";
|
||||
e.last_name = row[3] ? row[3] : "";
|
||||
e.title = row[4] ? row[4] : "";
|
||||
e.suffix = row[5] ? row[5] : "";
|
||||
e.zone_id = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.zone_instance = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.y = strtof(row[8], nullptr);
|
||||
e.x = strtof(row[9], nullptr);
|
||||
e.z = strtof(row[10], nullptr);
|
||||
e.heading = strtof(row[11], nullptr);
|
||||
e.gender = static_cast<uint8_t>(strtoul(row[12], nullptr, 10));
|
||||
e.race = static_cast<uint16_t>(strtoul(row[13], nullptr, 10));
|
||||
e.class_ = static_cast<uint8_t>(strtoul(row[14], nullptr, 10));
|
||||
e.level = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
||||
e.deity = static_cast<uint32_t>(strtoul(row[16], nullptr, 10));
|
||||
e.birthday = static_cast<uint32_t>(strtoul(row[17], nullptr, 10));
|
||||
e.last_login = static_cast<uint32_t>(strtoul(row[18], nullptr, 10));
|
||||
e.time_played = static_cast<uint32_t>(strtoul(row[19], nullptr, 10));
|
||||
e.level2 = static_cast<uint8_t>(strtoul(row[20], nullptr, 10));
|
||||
e.anon = static_cast<uint8_t>(strtoul(row[21], nullptr, 10));
|
||||
e.gm = static_cast<uint8_t>(strtoul(row[22], nullptr, 10));
|
||||
e.face = static_cast<uint32_t>(strtoul(row[23], nullptr, 10));
|
||||
e.hair_color = static_cast<uint8_t>(strtoul(row[24], nullptr, 10));
|
||||
e.hair_style = static_cast<uint8_t>(strtoul(row[25], nullptr, 10));
|
||||
e.beard = static_cast<uint8_t>(strtoul(row[26], nullptr, 10));
|
||||
e.beard_color = static_cast<uint8_t>(strtoul(row[27], nullptr, 10));
|
||||
e.eye_color_1 = static_cast<uint8_t>(strtoul(row[28], nullptr, 10));
|
||||
e.eye_color_2 = static_cast<uint8_t>(strtoul(row[29], nullptr, 10));
|
||||
e.drakkin_heritage = static_cast<uint32_t>(strtoul(row[30], nullptr, 10));
|
||||
e.drakkin_tattoo = static_cast<uint32_t>(strtoul(row[31], nullptr, 10));
|
||||
e.drakkin_details = static_cast<uint32_t>(strtoul(row[32], nullptr, 10));
|
||||
e.ability_time_seconds = static_cast<uint8_t>(strtoul(row[33], nullptr, 10));
|
||||
e.ability_number = static_cast<uint8_t>(strtoul(row[34], nullptr, 10));
|
||||
e.ability_time_minutes = static_cast<uint8_t>(strtoul(row[35], nullptr, 10));
|
||||
e.ability_time_hours = static_cast<uint8_t>(strtoul(row[36], nullptr, 10));
|
||||
e.exp = static_cast<uint32_t>(strtoul(row[37], nullptr, 10));
|
||||
e.exp_enabled = static_cast<uint8_t>(strtoul(row[38], nullptr, 10));
|
||||
e.aa_points_spent = static_cast<uint32_t>(strtoul(row[39], nullptr, 10));
|
||||
e.aa_exp = static_cast<uint32_t>(strtoul(row[40], nullptr, 10));
|
||||
e.aa_points = static_cast<uint32_t>(strtoul(row[41], nullptr, 10));
|
||||
e.group_leadership_exp = static_cast<uint32_t>(strtoul(row[42], nullptr, 10));
|
||||
e.raid_leadership_exp = static_cast<uint32_t>(strtoul(row[43], nullptr, 10));
|
||||
e.group_leadership_points = static_cast<uint32_t>(strtoul(row[44], nullptr, 10));
|
||||
e.raid_leadership_points = static_cast<uint32_t>(strtoul(row[45], nullptr, 10));
|
||||
e.points = static_cast<uint32_t>(strtoul(row[46], nullptr, 10));
|
||||
e.cur_hp = static_cast<uint32_t>(strtoul(row[47], nullptr, 10));
|
||||
e.mana = static_cast<uint32_t>(strtoul(row[48], nullptr, 10));
|
||||
e.endurance = static_cast<uint32_t>(strtoul(row[49], nullptr, 10));
|
||||
e.intoxication = static_cast<uint32_t>(strtoul(row[50], nullptr, 10));
|
||||
e.str = static_cast<uint32_t>(strtoul(row[51], nullptr, 10));
|
||||
e.sta = static_cast<uint32_t>(strtoul(row[52], nullptr, 10));
|
||||
e.cha = static_cast<uint32_t>(strtoul(row[53], nullptr, 10));
|
||||
e.dex = static_cast<uint32_t>(strtoul(row[54], nullptr, 10));
|
||||
e.int_ = static_cast<uint32_t>(strtoul(row[55], nullptr, 10));
|
||||
e.agi = static_cast<uint32_t>(strtoul(row[56], nullptr, 10));
|
||||
e.wis = static_cast<uint32_t>(strtoul(row[57], nullptr, 10));
|
||||
e.zone_change_count = static_cast<uint32_t>(strtoul(row[58], nullptr, 10));
|
||||
e.toxicity = static_cast<uint32_t>(strtoul(row[59], nullptr, 10));
|
||||
e.hunger_level = static_cast<uint32_t>(strtoul(row[60], nullptr, 10));
|
||||
e.thirst_level = static_cast<uint32_t>(strtoul(row[61], nullptr, 10));
|
||||
e.ability_up = static_cast<uint32_t>(strtoul(row[62], nullptr, 10));
|
||||
e.ldon_points_guk = static_cast<uint32_t>(strtoul(row[63], nullptr, 10));
|
||||
e.ldon_points_mir = static_cast<uint32_t>(strtoul(row[64], nullptr, 10));
|
||||
e.ldon_points_mmc = static_cast<uint32_t>(strtoul(row[65], nullptr, 10));
|
||||
e.ldon_points_ruj = static_cast<uint32_t>(strtoul(row[66], nullptr, 10));
|
||||
e.ldon_points_tak = static_cast<uint32_t>(strtoul(row[67], nullptr, 10));
|
||||
e.ldon_points_available = static_cast<uint32_t>(strtoul(row[68], nullptr, 10));
|
||||
e.tribute_time_remaining = static_cast<uint32_t>(strtoul(row[69], nullptr, 10));
|
||||
e.career_tribute_points = static_cast<uint32_t>(strtoul(row[70], nullptr, 10));
|
||||
e.tribute_points = static_cast<uint32_t>(strtoul(row[71], nullptr, 10));
|
||||
e.tribute_active = static_cast<uint32_t>(strtoul(row[72], nullptr, 10));
|
||||
e.pvp_status = static_cast<uint8_t>(strtoul(row[73], nullptr, 10));
|
||||
e.pvp_kills = static_cast<uint32_t>(strtoul(row[74], nullptr, 10));
|
||||
e.pvp_deaths = static_cast<uint32_t>(strtoul(row[75], nullptr, 10));
|
||||
e.pvp_current_points = static_cast<uint32_t>(strtoul(row[76], nullptr, 10));
|
||||
e.pvp_career_points = static_cast<uint32_t>(strtoul(row[77], nullptr, 10));
|
||||
e.pvp_best_kill_streak = static_cast<uint32_t>(strtoul(row[78], nullptr, 10));
|
||||
e.pvp_worst_death_streak = static_cast<uint32_t>(strtoul(row[79], nullptr, 10));
|
||||
e.pvp_current_kill_streak = static_cast<uint32_t>(strtoul(row[80], nullptr, 10));
|
||||
e.pvp2 = static_cast<uint32_t>(strtoul(row[81], nullptr, 10));
|
||||
e.pvp_type = static_cast<uint32_t>(strtoul(row[82], nullptr, 10));
|
||||
e.show_helm = static_cast<uint32_t>(strtoul(row[83], nullptr, 10));
|
||||
e.group_auto_consent = static_cast<uint8_t>(strtoul(row[84], nullptr, 10));
|
||||
e.raid_auto_consent = static_cast<uint8_t>(strtoul(row[85], nullptr, 10));
|
||||
e.guild_auto_consent = static_cast<uint8_t>(strtoul(row[86], nullptr, 10));
|
||||
e.leadership_exp_on = static_cast<uint8_t>(strtoul(row[87], nullptr, 10));
|
||||
e.RestTimer = static_cast<uint32_t>(strtoul(row[88], nullptr, 10));
|
||||
e.air_remaining = static_cast<uint32_t>(strtoul(row[89], nullptr, 10));
|
||||
e.autosplit_enabled = static_cast<uint32_t>(strtoul(row[90], nullptr, 10));
|
||||
e.lfp = static_cast<uint8_t>(strtoul(row[91], nullptr, 10));
|
||||
e.lfg = static_cast<uint8_t>(strtoul(row[92], nullptr, 10));
|
||||
e.zone_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.zone_instance = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.y = row[8] ? strtof(row[8], nullptr) : 0;
|
||||
e.x = row[9] ? strtof(row[9], nullptr) : 0;
|
||||
e.z = row[10] ? strtof(row[10], nullptr) : 0;
|
||||
e.heading = row[11] ? strtof(row[11], nullptr) : 0;
|
||||
e.gender = row[12] ? static_cast<uint8_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.race = row[13] ? static_cast<uint16_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.class_ = row[14] ? static_cast<uint8_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||
e.level = row[15] ? static_cast<uint32_t>(strtoul(row[15], nullptr, 10)) : 0;
|
||||
e.deity = row[16] ? static_cast<uint32_t>(strtoul(row[16], nullptr, 10)) : 0;
|
||||
e.birthday = row[17] ? static_cast<uint32_t>(strtoul(row[17], nullptr, 10)) : 0;
|
||||
e.last_login = row[18] ? static_cast<uint32_t>(strtoul(row[18], nullptr, 10)) : 0;
|
||||
e.time_played = row[19] ? static_cast<uint32_t>(strtoul(row[19], nullptr, 10)) : 0;
|
||||
e.level2 = row[20] ? static_cast<uint8_t>(strtoul(row[20], nullptr, 10)) : 0;
|
||||
e.anon = row[21] ? static_cast<uint8_t>(strtoul(row[21], nullptr, 10)) : 0;
|
||||
e.gm = row[22] ? static_cast<uint8_t>(strtoul(row[22], nullptr, 10)) : 0;
|
||||
e.face = row[23] ? static_cast<uint32_t>(strtoul(row[23], nullptr, 10)) : 0;
|
||||
e.hair_color = row[24] ? static_cast<uint8_t>(strtoul(row[24], nullptr, 10)) : 0;
|
||||
e.hair_style = row[25] ? static_cast<uint8_t>(strtoul(row[25], nullptr, 10)) : 0;
|
||||
e.beard = row[26] ? static_cast<uint8_t>(strtoul(row[26], nullptr, 10)) : 0;
|
||||
e.beard_color = row[27] ? static_cast<uint8_t>(strtoul(row[27], nullptr, 10)) : 0;
|
||||
e.eye_color_1 = row[28] ? static_cast<uint8_t>(strtoul(row[28], nullptr, 10)) : 0;
|
||||
e.eye_color_2 = row[29] ? static_cast<uint8_t>(strtoul(row[29], nullptr, 10)) : 0;
|
||||
e.drakkin_heritage = row[30] ? static_cast<uint32_t>(strtoul(row[30], nullptr, 10)) : 0;
|
||||
e.drakkin_tattoo = row[31] ? static_cast<uint32_t>(strtoul(row[31], nullptr, 10)) : 0;
|
||||
e.drakkin_details = row[32] ? static_cast<uint32_t>(strtoul(row[32], nullptr, 10)) : 0;
|
||||
e.ability_time_seconds = row[33] ? static_cast<uint8_t>(strtoul(row[33], nullptr, 10)) : 0;
|
||||
e.ability_number = row[34] ? static_cast<uint8_t>(strtoul(row[34], nullptr, 10)) : 0;
|
||||
e.ability_time_minutes = row[35] ? static_cast<uint8_t>(strtoul(row[35], nullptr, 10)) : 0;
|
||||
e.ability_time_hours = row[36] ? static_cast<uint8_t>(strtoul(row[36], nullptr, 10)) : 0;
|
||||
e.exp = row[37] ? static_cast<uint32_t>(strtoul(row[37], nullptr, 10)) : 0;
|
||||
e.exp_enabled = row[38] ? static_cast<uint8_t>(strtoul(row[38], nullptr, 10)) : 1;
|
||||
e.aa_points_spent = row[39] ? static_cast<uint32_t>(strtoul(row[39], nullptr, 10)) : 0;
|
||||
e.aa_exp = row[40] ? static_cast<uint32_t>(strtoul(row[40], nullptr, 10)) : 0;
|
||||
e.aa_points = row[41] ? static_cast<uint32_t>(strtoul(row[41], nullptr, 10)) : 0;
|
||||
e.group_leadership_exp = row[42] ? static_cast<uint32_t>(strtoul(row[42], nullptr, 10)) : 0;
|
||||
e.raid_leadership_exp = row[43] ? static_cast<uint32_t>(strtoul(row[43], nullptr, 10)) : 0;
|
||||
e.group_leadership_points = row[44] ? static_cast<uint32_t>(strtoul(row[44], nullptr, 10)) : 0;
|
||||
e.raid_leadership_points = row[45] ? static_cast<uint32_t>(strtoul(row[45], nullptr, 10)) : 0;
|
||||
e.points = row[46] ? static_cast<uint32_t>(strtoul(row[46], nullptr, 10)) : 0;
|
||||
e.cur_hp = row[47] ? static_cast<uint32_t>(strtoul(row[47], nullptr, 10)) : 0;
|
||||
e.mana = row[48] ? static_cast<uint32_t>(strtoul(row[48], nullptr, 10)) : 0;
|
||||
e.endurance = row[49] ? static_cast<uint32_t>(strtoul(row[49], nullptr, 10)) : 0;
|
||||
e.intoxication = row[50] ? static_cast<uint32_t>(strtoul(row[50], nullptr, 10)) : 0;
|
||||
e.str = row[51] ? static_cast<uint32_t>(strtoul(row[51], nullptr, 10)) : 0;
|
||||
e.sta = row[52] ? static_cast<uint32_t>(strtoul(row[52], nullptr, 10)) : 0;
|
||||
e.cha = row[53] ? static_cast<uint32_t>(strtoul(row[53], nullptr, 10)) : 0;
|
||||
e.dex = row[54] ? static_cast<uint32_t>(strtoul(row[54], nullptr, 10)) : 0;
|
||||
e.int_ = row[55] ? static_cast<uint32_t>(strtoul(row[55], nullptr, 10)) : 0;
|
||||
e.agi = row[56] ? static_cast<uint32_t>(strtoul(row[56], nullptr, 10)) : 0;
|
||||
e.wis = row[57] ? static_cast<uint32_t>(strtoul(row[57], nullptr, 10)) : 0;
|
||||
e.zone_change_count = row[58] ? static_cast<uint32_t>(strtoul(row[58], nullptr, 10)) : 0;
|
||||
e.toxicity = row[59] ? static_cast<uint32_t>(strtoul(row[59], nullptr, 10)) : 0;
|
||||
e.hunger_level = row[60] ? static_cast<uint32_t>(strtoul(row[60], nullptr, 10)) : 0;
|
||||
e.thirst_level = row[61] ? static_cast<uint32_t>(strtoul(row[61], nullptr, 10)) : 0;
|
||||
e.ability_up = row[62] ? static_cast<uint32_t>(strtoul(row[62], nullptr, 10)) : 0;
|
||||
e.ldon_points_guk = row[63] ? static_cast<uint32_t>(strtoul(row[63], nullptr, 10)) : 0;
|
||||
e.ldon_points_mir = row[64] ? static_cast<uint32_t>(strtoul(row[64], nullptr, 10)) : 0;
|
||||
e.ldon_points_mmc = row[65] ? static_cast<uint32_t>(strtoul(row[65], nullptr, 10)) : 0;
|
||||
e.ldon_points_ruj = row[66] ? static_cast<uint32_t>(strtoul(row[66], nullptr, 10)) : 0;
|
||||
e.ldon_points_tak = row[67] ? static_cast<uint32_t>(strtoul(row[67], nullptr, 10)) : 0;
|
||||
e.ldon_points_available = row[68] ? static_cast<uint32_t>(strtoul(row[68], nullptr, 10)) : 0;
|
||||
e.tribute_time_remaining = row[69] ? static_cast<uint32_t>(strtoul(row[69], nullptr, 10)) : 0;
|
||||
e.career_tribute_points = row[70] ? static_cast<uint32_t>(strtoul(row[70], nullptr, 10)) : 0;
|
||||
e.tribute_points = row[71] ? static_cast<uint32_t>(strtoul(row[71], nullptr, 10)) : 0;
|
||||
e.tribute_active = row[72] ? static_cast<uint32_t>(strtoul(row[72], nullptr, 10)) : 0;
|
||||
e.pvp_status = row[73] ? static_cast<uint8_t>(strtoul(row[73], nullptr, 10)) : 0;
|
||||
e.pvp_kills = row[74] ? static_cast<uint32_t>(strtoul(row[74], nullptr, 10)) : 0;
|
||||
e.pvp_deaths = row[75] ? static_cast<uint32_t>(strtoul(row[75], nullptr, 10)) : 0;
|
||||
e.pvp_current_points = row[76] ? static_cast<uint32_t>(strtoul(row[76], nullptr, 10)) : 0;
|
||||
e.pvp_career_points = row[77] ? static_cast<uint32_t>(strtoul(row[77], nullptr, 10)) : 0;
|
||||
e.pvp_best_kill_streak = row[78] ? static_cast<uint32_t>(strtoul(row[78], nullptr, 10)) : 0;
|
||||
e.pvp_worst_death_streak = row[79] ? static_cast<uint32_t>(strtoul(row[79], nullptr, 10)) : 0;
|
||||
e.pvp_current_kill_streak = row[80] ? static_cast<uint32_t>(strtoul(row[80], nullptr, 10)) : 0;
|
||||
e.pvp2 = row[81] ? static_cast<uint32_t>(strtoul(row[81], nullptr, 10)) : 0;
|
||||
e.pvp_type = row[82] ? static_cast<uint32_t>(strtoul(row[82], nullptr, 10)) : 0;
|
||||
e.show_helm = row[83] ? static_cast<uint32_t>(strtoul(row[83], nullptr, 10)) : 0;
|
||||
e.group_auto_consent = row[84] ? static_cast<uint8_t>(strtoul(row[84], nullptr, 10)) : 0;
|
||||
e.raid_auto_consent = row[85] ? static_cast<uint8_t>(strtoul(row[85], nullptr, 10)) : 0;
|
||||
e.guild_auto_consent = row[86] ? static_cast<uint8_t>(strtoul(row[86], nullptr, 10)) : 0;
|
||||
e.leadership_exp_on = row[87] ? static_cast<uint8_t>(strtoul(row[87], nullptr, 10)) : 0;
|
||||
e.RestTimer = row[88] ? static_cast<uint32_t>(strtoul(row[88], nullptr, 10)) : 0;
|
||||
e.air_remaining = row[89] ? static_cast<uint32_t>(strtoul(row[89], nullptr, 10)) : 0;
|
||||
e.autosplit_enabled = row[90] ? static_cast<uint32_t>(strtoul(row[90], nullptr, 10)) : 0;
|
||||
e.lfp = row[91] ? static_cast<uint8_t>(strtoul(row[91], nullptr, 10)) : 0;
|
||||
e.lfg = row[92] ? static_cast<uint8_t>(strtoul(row[92], nullptr, 10)) : 0;
|
||||
e.mailkey = row[93] ? row[93] : "";
|
||||
e.xtargets = static_cast<uint8_t>(strtoul(row[94], nullptr, 10));
|
||||
e.firstlogon = static_cast<int8_t>(atoi(row[95]));
|
||||
e.e_aa_effects = static_cast<uint32_t>(strtoul(row[96], nullptr, 10));
|
||||
e.e_percent_to_aa = static_cast<uint32_t>(strtoul(row[97], nullptr, 10));
|
||||
e.e_expended_aa_spent = static_cast<uint32_t>(strtoul(row[98], nullptr, 10));
|
||||
e.aa_points_spent_old = static_cast<uint32_t>(strtoul(row[99], nullptr, 10));
|
||||
e.aa_points_old = static_cast<uint32_t>(strtoul(row[100], nullptr, 10));
|
||||
e.e_last_invsnapshot = static_cast<uint32_t>(strtoul(row[101], nullptr, 10));
|
||||
e.xtargets = row[94] ? static_cast<uint8_t>(strtoul(row[94], nullptr, 10)) : 5;
|
||||
e.firstlogon = row[95] ? static_cast<int8_t>(atoi(row[95])) : 0;
|
||||
e.e_aa_effects = row[96] ? static_cast<uint32_t>(strtoul(row[96], nullptr, 10)) : 0;
|
||||
e.e_percent_to_aa = row[97] ? static_cast<uint32_t>(strtoul(row[97], nullptr, 10)) : 0;
|
||||
e.e_expended_aa_spent = row[98] ? static_cast<uint32_t>(strtoul(row[98], nullptr, 10)) : 0;
|
||||
e.aa_points_spent_old = row[99] ? static_cast<uint32_t>(strtoul(row[99], nullptr, 10)) : 0;
|
||||
e.aa_points_old = row[100] ? static_cast<uint32_t>(strtoul(row[100], nullptr, 10)) : 0;
|
||||
e.e_last_invsnapshot = row[101] ? static_cast<uint32_t>(strtoul(row[101], nullptr, 10)) : 0;
|
||||
e.deleted_at = strtoll(row[102] ? row[102] : "-1", nullptr, 10);
|
||||
|
||||
all_entries.push_back(e);
|
||||
@@ -1178,108 +1177,108 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterData e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.account_id = static_cast<int32_t>(atoi(row[1]));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.account_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.name = row[2] ? row[2] : "";
|
||||
e.last_name = row[3] ? row[3] : "";
|
||||
e.title = row[4] ? row[4] : "";
|
||||
e.suffix = row[5] ? row[5] : "";
|
||||
e.zone_id = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.zone_instance = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.y = strtof(row[8], nullptr);
|
||||
e.x = strtof(row[9], nullptr);
|
||||
e.z = strtof(row[10], nullptr);
|
||||
e.heading = strtof(row[11], nullptr);
|
||||
e.gender = static_cast<uint8_t>(strtoul(row[12], nullptr, 10));
|
||||
e.race = static_cast<uint16_t>(strtoul(row[13], nullptr, 10));
|
||||
e.class_ = static_cast<uint8_t>(strtoul(row[14], nullptr, 10));
|
||||
e.level = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
||||
e.deity = static_cast<uint32_t>(strtoul(row[16], nullptr, 10));
|
||||
e.birthday = static_cast<uint32_t>(strtoul(row[17], nullptr, 10));
|
||||
e.last_login = static_cast<uint32_t>(strtoul(row[18], nullptr, 10));
|
||||
e.time_played = static_cast<uint32_t>(strtoul(row[19], nullptr, 10));
|
||||
e.level2 = static_cast<uint8_t>(strtoul(row[20], nullptr, 10));
|
||||
e.anon = static_cast<uint8_t>(strtoul(row[21], nullptr, 10));
|
||||
e.gm = static_cast<uint8_t>(strtoul(row[22], nullptr, 10));
|
||||
e.face = static_cast<uint32_t>(strtoul(row[23], nullptr, 10));
|
||||
e.hair_color = static_cast<uint8_t>(strtoul(row[24], nullptr, 10));
|
||||
e.hair_style = static_cast<uint8_t>(strtoul(row[25], nullptr, 10));
|
||||
e.beard = static_cast<uint8_t>(strtoul(row[26], nullptr, 10));
|
||||
e.beard_color = static_cast<uint8_t>(strtoul(row[27], nullptr, 10));
|
||||
e.eye_color_1 = static_cast<uint8_t>(strtoul(row[28], nullptr, 10));
|
||||
e.eye_color_2 = static_cast<uint8_t>(strtoul(row[29], nullptr, 10));
|
||||
e.drakkin_heritage = static_cast<uint32_t>(strtoul(row[30], nullptr, 10));
|
||||
e.drakkin_tattoo = static_cast<uint32_t>(strtoul(row[31], nullptr, 10));
|
||||
e.drakkin_details = static_cast<uint32_t>(strtoul(row[32], nullptr, 10));
|
||||
e.ability_time_seconds = static_cast<uint8_t>(strtoul(row[33], nullptr, 10));
|
||||
e.ability_number = static_cast<uint8_t>(strtoul(row[34], nullptr, 10));
|
||||
e.ability_time_minutes = static_cast<uint8_t>(strtoul(row[35], nullptr, 10));
|
||||
e.ability_time_hours = static_cast<uint8_t>(strtoul(row[36], nullptr, 10));
|
||||
e.exp = static_cast<uint32_t>(strtoul(row[37], nullptr, 10));
|
||||
e.exp_enabled = static_cast<uint8_t>(strtoul(row[38], nullptr, 10));
|
||||
e.aa_points_spent = static_cast<uint32_t>(strtoul(row[39], nullptr, 10));
|
||||
e.aa_exp = static_cast<uint32_t>(strtoul(row[40], nullptr, 10));
|
||||
e.aa_points = static_cast<uint32_t>(strtoul(row[41], nullptr, 10));
|
||||
e.group_leadership_exp = static_cast<uint32_t>(strtoul(row[42], nullptr, 10));
|
||||
e.raid_leadership_exp = static_cast<uint32_t>(strtoul(row[43], nullptr, 10));
|
||||
e.group_leadership_points = static_cast<uint32_t>(strtoul(row[44], nullptr, 10));
|
||||
e.raid_leadership_points = static_cast<uint32_t>(strtoul(row[45], nullptr, 10));
|
||||
e.points = static_cast<uint32_t>(strtoul(row[46], nullptr, 10));
|
||||
e.cur_hp = static_cast<uint32_t>(strtoul(row[47], nullptr, 10));
|
||||
e.mana = static_cast<uint32_t>(strtoul(row[48], nullptr, 10));
|
||||
e.endurance = static_cast<uint32_t>(strtoul(row[49], nullptr, 10));
|
||||
e.intoxication = static_cast<uint32_t>(strtoul(row[50], nullptr, 10));
|
||||
e.str = static_cast<uint32_t>(strtoul(row[51], nullptr, 10));
|
||||
e.sta = static_cast<uint32_t>(strtoul(row[52], nullptr, 10));
|
||||
e.cha = static_cast<uint32_t>(strtoul(row[53], nullptr, 10));
|
||||
e.dex = static_cast<uint32_t>(strtoul(row[54], nullptr, 10));
|
||||
e.int_ = static_cast<uint32_t>(strtoul(row[55], nullptr, 10));
|
||||
e.agi = static_cast<uint32_t>(strtoul(row[56], nullptr, 10));
|
||||
e.wis = static_cast<uint32_t>(strtoul(row[57], nullptr, 10));
|
||||
e.zone_change_count = static_cast<uint32_t>(strtoul(row[58], nullptr, 10));
|
||||
e.toxicity = static_cast<uint32_t>(strtoul(row[59], nullptr, 10));
|
||||
e.hunger_level = static_cast<uint32_t>(strtoul(row[60], nullptr, 10));
|
||||
e.thirst_level = static_cast<uint32_t>(strtoul(row[61], nullptr, 10));
|
||||
e.ability_up = static_cast<uint32_t>(strtoul(row[62], nullptr, 10));
|
||||
e.ldon_points_guk = static_cast<uint32_t>(strtoul(row[63], nullptr, 10));
|
||||
e.ldon_points_mir = static_cast<uint32_t>(strtoul(row[64], nullptr, 10));
|
||||
e.ldon_points_mmc = static_cast<uint32_t>(strtoul(row[65], nullptr, 10));
|
||||
e.ldon_points_ruj = static_cast<uint32_t>(strtoul(row[66], nullptr, 10));
|
||||
e.ldon_points_tak = static_cast<uint32_t>(strtoul(row[67], nullptr, 10));
|
||||
e.ldon_points_available = static_cast<uint32_t>(strtoul(row[68], nullptr, 10));
|
||||
e.tribute_time_remaining = static_cast<uint32_t>(strtoul(row[69], nullptr, 10));
|
||||
e.career_tribute_points = static_cast<uint32_t>(strtoul(row[70], nullptr, 10));
|
||||
e.tribute_points = static_cast<uint32_t>(strtoul(row[71], nullptr, 10));
|
||||
e.tribute_active = static_cast<uint32_t>(strtoul(row[72], nullptr, 10));
|
||||
e.pvp_status = static_cast<uint8_t>(strtoul(row[73], nullptr, 10));
|
||||
e.pvp_kills = static_cast<uint32_t>(strtoul(row[74], nullptr, 10));
|
||||
e.pvp_deaths = static_cast<uint32_t>(strtoul(row[75], nullptr, 10));
|
||||
e.pvp_current_points = static_cast<uint32_t>(strtoul(row[76], nullptr, 10));
|
||||
e.pvp_career_points = static_cast<uint32_t>(strtoul(row[77], nullptr, 10));
|
||||
e.pvp_best_kill_streak = static_cast<uint32_t>(strtoul(row[78], nullptr, 10));
|
||||
e.pvp_worst_death_streak = static_cast<uint32_t>(strtoul(row[79], nullptr, 10));
|
||||
e.pvp_current_kill_streak = static_cast<uint32_t>(strtoul(row[80], nullptr, 10));
|
||||
e.pvp2 = static_cast<uint32_t>(strtoul(row[81], nullptr, 10));
|
||||
e.pvp_type = static_cast<uint32_t>(strtoul(row[82], nullptr, 10));
|
||||
e.show_helm = static_cast<uint32_t>(strtoul(row[83], nullptr, 10));
|
||||
e.group_auto_consent = static_cast<uint8_t>(strtoul(row[84], nullptr, 10));
|
||||
e.raid_auto_consent = static_cast<uint8_t>(strtoul(row[85], nullptr, 10));
|
||||
e.guild_auto_consent = static_cast<uint8_t>(strtoul(row[86], nullptr, 10));
|
||||
e.leadership_exp_on = static_cast<uint8_t>(strtoul(row[87], nullptr, 10));
|
||||
e.RestTimer = static_cast<uint32_t>(strtoul(row[88], nullptr, 10));
|
||||
e.air_remaining = static_cast<uint32_t>(strtoul(row[89], nullptr, 10));
|
||||
e.autosplit_enabled = static_cast<uint32_t>(strtoul(row[90], nullptr, 10));
|
||||
e.lfp = static_cast<uint8_t>(strtoul(row[91], nullptr, 10));
|
||||
e.lfg = static_cast<uint8_t>(strtoul(row[92], nullptr, 10));
|
||||
e.zone_id = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.zone_instance = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.y = row[8] ? strtof(row[8], nullptr) : 0;
|
||||
e.x = row[9] ? strtof(row[9], nullptr) : 0;
|
||||
e.z = row[10] ? strtof(row[10], nullptr) : 0;
|
||||
e.heading = row[11] ? strtof(row[11], nullptr) : 0;
|
||||
e.gender = row[12] ? static_cast<uint8_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.race = row[13] ? static_cast<uint16_t>(strtoul(row[13], nullptr, 10)) : 0;
|
||||
e.class_ = row[14] ? static_cast<uint8_t>(strtoul(row[14], nullptr, 10)) : 0;
|
||||
e.level = row[15] ? static_cast<uint32_t>(strtoul(row[15], nullptr, 10)) : 0;
|
||||
e.deity = row[16] ? static_cast<uint32_t>(strtoul(row[16], nullptr, 10)) : 0;
|
||||
e.birthday = row[17] ? static_cast<uint32_t>(strtoul(row[17], nullptr, 10)) : 0;
|
||||
e.last_login = row[18] ? static_cast<uint32_t>(strtoul(row[18], nullptr, 10)) : 0;
|
||||
e.time_played = row[19] ? static_cast<uint32_t>(strtoul(row[19], nullptr, 10)) : 0;
|
||||
e.level2 = row[20] ? static_cast<uint8_t>(strtoul(row[20], nullptr, 10)) : 0;
|
||||
e.anon = row[21] ? static_cast<uint8_t>(strtoul(row[21], nullptr, 10)) : 0;
|
||||
e.gm = row[22] ? static_cast<uint8_t>(strtoul(row[22], nullptr, 10)) : 0;
|
||||
e.face = row[23] ? static_cast<uint32_t>(strtoul(row[23], nullptr, 10)) : 0;
|
||||
e.hair_color = row[24] ? static_cast<uint8_t>(strtoul(row[24], nullptr, 10)) : 0;
|
||||
e.hair_style = row[25] ? static_cast<uint8_t>(strtoul(row[25], nullptr, 10)) : 0;
|
||||
e.beard = row[26] ? static_cast<uint8_t>(strtoul(row[26], nullptr, 10)) : 0;
|
||||
e.beard_color = row[27] ? static_cast<uint8_t>(strtoul(row[27], nullptr, 10)) : 0;
|
||||
e.eye_color_1 = row[28] ? static_cast<uint8_t>(strtoul(row[28], nullptr, 10)) : 0;
|
||||
e.eye_color_2 = row[29] ? static_cast<uint8_t>(strtoul(row[29], nullptr, 10)) : 0;
|
||||
e.drakkin_heritage = row[30] ? static_cast<uint32_t>(strtoul(row[30], nullptr, 10)) : 0;
|
||||
e.drakkin_tattoo = row[31] ? static_cast<uint32_t>(strtoul(row[31], nullptr, 10)) : 0;
|
||||
e.drakkin_details = row[32] ? static_cast<uint32_t>(strtoul(row[32], nullptr, 10)) : 0;
|
||||
e.ability_time_seconds = row[33] ? static_cast<uint8_t>(strtoul(row[33], nullptr, 10)) : 0;
|
||||
e.ability_number = row[34] ? static_cast<uint8_t>(strtoul(row[34], nullptr, 10)) : 0;
|
||||
e.ability_time_minutes = row[35] ? static_cast<uint8_t>(strtoul(row[35], nullptr, 10)) : 0;
|
||||
e.ability_time_hours = row[36] ? static_cast<uint8_t>(strtoul(row[36], nullptr, 10)) : 0;
|
||||
e.exp = row[37] ? static_cast<uint32_t>(strtoul(row[37], nullptr, 10)) : 0;
|
||||
e.exp_enabled = row[38] ? static_cast<uint8_t>(strtoul(row[38], nullptr, 10)) : 1;
|
||||
e.aa_points_spent = row[39] ? static_cast<uint32_t>(strtoul(row[39], nullptr, 10)) : 0;
|
||||
e.aa_exp = row[40] ? static_cast<uint32_t>(strtoul(row[40], nullptr, 10)) : 0;
|
||||
e.aa_points = row[41] ? static_cast<uint32_t>(strtoul(row[41], nullptr, 10)) : 0;
|
||||
e.group_leadership_exp = row[42] ? static_cast<uint32_t>(strtoul(row[42], nullptr, 10)) : 0;
|
||||
e.raid_leadership_exp = row[43] ? static_cast<uint32_t>(strtoul(row[43], nullptr, 10)) : 0;
|
||||
e.group_leadership_points = row[44] ? static_cast<uint32_t>(strtoul(row[44], nullptr, 10)) : 0;
|
||||
e.raid_leadership_points = row[45] ? static_cast<uint32_t>(strtoul(row[45], nullptr, 10)) : 0;
|
||||
e.points = row[46] ? static_cast<uint32_t>(strtoul(row[46], nullptr, 10)) : 0;
|
||||
e.cur_hp = row[47] ? static_cast<uint32_t>(strtoul(row[47], nullptr, 10)) : 0;
|
||||
e.mana = row[48] ? static_cast<uint32_t>(strtoul(row[48], nullptr, 10)) : 0;
|
||||
e.endurance = row[49] ? static_cast<uint32_t>(strtoul(row[49], nullptr, 10)) : 0;
|
||||
e.intoxication = row[50] ? static_cast<uint32_t>(strtoul(row[50], nullptr, 10)) : 0;
|
||||
e.str = row[51] ? static_cast<uint32_t>(strtoul(row[51], nullptr, 10)) : 0;
|
||||
e.sta = row[52] ? static_cast<uint32_t>(strtoul(row[52], nullptr, 10)) : 0;
|
||||
e.cha = row[53] ? static_cast<uint32_t>(strtoul(row[53], nullptr, 10)) : 0;
|
||||
e.dex = row[54] ? static_cast<uint32_t>(strtoul(row[54], nullptr, 10)) : 0;
|
||||
e.int_ = row[55] ? static_cast<uint32_t>(strtoul(row[55], nullptr, 10)) : 0;
|
||||
e.agi = row[56] ? static_cast<uint32_t>(strtoul(row[56], nullptr, 10)) : 0;
|
||||
e.wis = row[57] ? static_cast<uint32_t>(strtoul(row[57], nullptr, 10)) : 0;
|
||||
e.zone_change_count = row[58] ? static_cast<uint32_t>(strtoul(row[58], nullptr, 10)) : 0;
|
||||
e.toxicity = row[59] ? static_cast<uint32_t>(strtoul(row[59], nullptr, 10)) : 0;
|
||||
e.hunger_level = row[60] ? static_cast<uint32_t>(strtoul(row[60], nullptr, 10)) : 0;
|
||||
e.thirst_level = row[61] ? static_cast<uint32_t>(strtoul(row[61], nullptr, 10)) : 0;
|
||||
e.ability_up = row[62] ? static_cast<uint32_t>(strtoul(row[62], nullptr, 10)) : 0;
|
||||
e.ldon_points_guk = row[63] ? static_cast<uint32_t>(strtoul(row[63], nullptr, 10)) : 0;
|
||||
e.ldon_points_mir = row[64] ? static_cast<uint32_t>(strtoul(row[64], nullptr, 10)) : 0;
|
||||
e.ldon_points_mmc = row[65] ? static_cast<uint32_t>(strtoul(row[65], nullptr, 10)) : 0;
|
||||
e.ldon_points_ruj = row[66] ? static_cast<uint32_t>(strtoul(row[66], nullptr, 10)) : 0;
|
||||
e.ldon_points_tak = row[67] ? static_cast<uint32_t>(strtoul(row[67], nullptr, 10)) : 0;
|
||||
e.ldon_points_available = row[68] ? static_cast<uint32_t>(strtoul(row[68], nullptr, 10)) : 0;
|
||||
e.tribute_time_remaining = row[69] ? static_cast<uint32_t>(strtoul(row[69], nullptr, 10)) : 0;
|
||||
e.career_tribute_points = row[70] ? static_cast<uint32_t>(strtoul(row[70], nullptr, 10)) : 0;
|
||||
e.tribute_points = row[71] ? static_cast<uint32_t>(strtoul(row[71], nullptr, 10)) : 0;
|
||||
e.tribute_active = row[72] ? static_cast<uint32_t>(strtoul(row[72], nullptr, 10)) : 0;
|
||||
e.pvp_status = row[73] ? static_cast<uint8_t>(strtoul(row[73], nullptr, 10)) : 0;
|
||||
e.pvp_kills = row[74] ? static_cast<uint32_t>(strtoul(row[74], nullptr, 10)) : 0;
|
||||
e.pvp_deaths = row[75] ? static_cast<uint32_t>(strtoul(row[75], nullptr, 10)) : 0;
|
||||
e.pvp_current_points = row[76] ? static_cast<uint32_t>(strtoul(row[76], nullptr, 10)) : 0;
|
||||
e.pvp_career_points = row[77] ? static_cast<uint32_t>(strtoul(row[77], nullptr, 10)) : 0;
|
||||
e.pvp_best_kill_streak = row[78] ? static_cast<uint32_t>(strtoul(row[78], nullptr, 10)) : 0;
|
||||
e.pvp_worst_death_streak = row[79] ? static_cast<uint32_t>(strtoul(row[79], nullptr, 10)) : 0;
|
||||
e.pvp_current_kill_streak = row[80] ? static_cast<uint32_t>(strtoul(row[80], nullptr, 10)) : 0;
|
||||
e.pvp2 = row[81] ? static_cast<uint32_t>(strtoul(row[81], nullptr, 10)) : 0;
|
||||
e.pvp_type = row[82] ? static_cast<uint32_t>(strtoul(row[82], nullptr, 10)) : 0;
|
||||
e.show_helm = row[83] ? static_cast<uint32_t>(strtoul(row[83], nullptr, 10)) : 0;
|
||||
e.group_auto_consent = row[84] ? static_cast<uint8_t>(strtoul(row[84], nullptr, 10)) : 0;
|
||||
e.raid_auto_consent = row[85] ? static_cast<uint8_t>(strtoul(row[85], nullptr, 10)) : 0;
|
||||
e.guild_auto_consent = row[86] ? static_cast<uint8_t>(strtoul(row[86], nullptr, 10)) : 0;
|
||||
e.leadership_exp_on = row[87] ? static_cast<uint8_t>(strtoul(row[87], nullptr, 10)) : 0;
|
||||
e.RestTimer = row[88] ? static_cast<uint32_t>(strtoul(row[88], nullptr, 10)) : 0;
|
||||
e.air_remaining = row[89] ? static_cast<uint32_t>(strtoul(row[89], nullptr, 10)) : 0;
|
||||
e.autosplit_enabled = row[90] ? static_cast<uint32_t>(strtoul(row[90], nullptr, 10)) : 0;
|
||||
e.lfp = row[91] ? static_cast<uint8_t>(strtoul(row[91], nullptr, 10)) : 0;
|
||||
e.lfg = row[92] ? static_cast<uint8_t>(strtoul(row[92], nullptr, 10)) : 0;
|
||||
e.mailkey = row[93] ? row[93] : "";
|
||||
e.xtargets = static_cast<uint8_t>(strtoul(row[94], nullptr, 10));
|
||||
e.firstlogon = static_cast<int8_t>(atoi(row[95]));
|
||||
e.e_aa_effects = static_cast<uint32_t>(strtoul(row[96], nullptr, 10));
|
||||
e.e_percent_to_aa = static_cast<uint32_t>(strtoul(row[97], nullptr, 10));
|
||||
e.e_expended_aa_spent = static_cast<uint32_t>(strtoul(row[98], nullptr, 10));
|
||||
e.aa_points_spent_old = static_cast<uint32_t>(strtoul(row[99], nullptr, 10));
|
||||
e.aa_points_old = static_cast<uint32_t>(strtoul(row[100], nullptr, 10));
|
||||
e.e_last_invsnapshot = static_cast<uint32_t>(strtoul(row[101], nullptr, 10));
|
||||
e.xtargets = row[94] ? static_cast<uint8_t>(strtoul(row[94], nullptr, 10)) : 5;
|
||||
e.firstlogon = row[95] ? static_cast<int8_t>(atoi(row[95])) : 0;
|
||||
e.e_aa_effects = row[96] ? static_cast<uint32_t>(strtoul(row[96], nullptr, 10)) : 0;
|
||||
e.e_percent_to_aa = row[97] ? static_cast<uint32_t>(strtoul(row[97], nullptr, 10)) : 0;
|
||||
e.e_expended_aa_spent = row[98] ? static_cast<uint32_t>(strtoul(row[98], nullptr, 10)) : 0;
|
||||
e.aa_points_spent_old = row[99] ? static_cast<uint32_t>(strtoul(row[99], nullptr, 10)) : 0;
|
||||
e.aa_points_old = row[100] ? static_cast<uint32_t>(strtoul(row[100], nullptr, 10)) : 0;
|
||||
e.e_last_invsnapshot = row[101] ? static_cast<uint32_t>(strtoul(row[101], nullptr, 10)) : 0;
|
||||
e.deleted_at = strtoll(row[102] ? row[102] : "-1", nullptr, 10);
|
||||
|
||||
all_entries.push_back(e);
|
||||
@@ -1339,6 +1338,266 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterData &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.account_id));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.last_name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.title) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.suffix) + "'");
|
||||
v.push_back(std::to_string(e.zone_id));
|
||||
v.push_back(std::to_string(e.zone_instance));
|
||||
v.push_back(std::to_string(e.y));
|
||||
v.push_back(std::to_string(e.x));
|
||||
v.push_back(std::to_string(e.z));
|
||||
v.push_back(std::to_string(e.heading));
|
||||
v.push_back(std::to_string(e.gender));
|
||||
v.push_back(std::to_string(e.race));
|
||||
v.push_back(std::to_string(e.class_));
|
||||
v.push_back(std::to_string(e.level));
|
||||
v.push_back(std::to_string(e.deity));
|
||||
v.push_back(std::to_string(e.birthday));
|
||||
v.push_back(std::to_string(e.last_login));
|
||||
v.push_back(std::to_string(e.time_played));
|
||||
v.push_back(std::to_string(e.level2));
|
||||
v.push_back(std::to_string(e.anon));
|
||||
v.push_back(std::to_string(e.gm));
|
||||
v.push_back(std::to_string(e.face));
|
||||
v.push_back(std::to_string(e.hair_color));
|
||||
v.push_back(std::to_string(e.hair_style));
|
||||
v.push_back(std::to_string(e.beard));
|
||||
v.push_back(std::to_string(e.beard_color));
|
||||
v.push_back(std::to_string(e.eye_color_1));
|
||||
v.push_back(std::to_string(e.eye_color_2));
|
||||
v.push_back(std::to_string(e.drakkin_heritage));
|
||||
v.push_back(std::to_string(e.drakkin_tattoo));
|
||||
v.push_back(std::to_string(e.drakkin_details));
|
||||
v.push_back(std::to_string(e.ability_time_seconds));
|
||||
v.push_back(std::to_string(e.ability_number));
|
||||
v.push_back(std::to_string(e.ability_time_minutes));
|
||||
v.push_back(std::to_string(e.ability_time_hours));
|
||||
v.push_back(std::to_string(e.exp));
|
||||
v.push_back(std::to_string(e.exp_enabled));
|
||||
v.push_back(std::to_string(e.aa_points_spent));
|
||||
v.push_back(std::to_string(e.aa_exp));
|
||||
v.push_back(std::to_string(e.aa_points));
|
||||
v.push_back(std::to_string(e.group_leadership_exp));
|
||||
v.push_back(std::to_string(e.raid_leadership_exp));
|
||||
v.push_back(std::to_string(e.group_leadership_points));
|
||||
v.push_back(std::to_string(e.raid_leadership_points));
|
||||
v.push_back(std::to_string(e.points));
|
||||
v.push_back(std::to_string(e.cur_hp));
|
||||
v.push_back(std::to_string(e.mana));
|
||||
v.push_back(std::to_string(e.endurance));
|
||||
v.push_back(std::to_string(e.intoxication));
|
||||
v.push_back(std::to_string(e.str));
|
||||
v.push_back(std::to_string(e.sta));
|
||||
v.push_back(std::to_string(e.cha));
|
||||
v.push_back(std::to_string(e.dex));
|
||||
v.push_back(std::to_string(e.int_));
|
||||
v.push_back(std::to_string(e.agi));
|
||||
v.push_back(std::to_string(e.wis));
|
||||
v.push_back(std::to_string(e.zone_change_count));
|
||||
v.push_back(std::to_string(e.toxicity));
|
||||
v.push_back(std::to_string(e.hunger_level));
|
||||
v.push_back(std::to_string(e.thirst_level));
|
||||
v.push_back(std::to_string(e.ability_up));
|
||||
v.push_back(std::to_string(e.ldon_points_guk));
|
||||
v.push_back(std::to_string(e.ldon_points_mir));
|
||||
v.push_back(std::to_string(e.ldon_points_mmc));
|
||||
v.push_back(std::to_string(e.ldon_points_ruj));
|
||||
v.push_back(std::to_string(e.ldon_points_tak));
|
||||
v.push_back(std::to_string(e.ldon_points_available));
|
||||
v.push_back(std::to_string(e.tribute_time_remaining));
|
||||
v.push_back(std::to_string(e.career_tribute_points));
|
||||
v.push_back(std::to_string(e.tribute_points));
|
||||
v.push_back(std::to_string(e.tribute_active));
|
||||
v.push_back(std::to_string(e.pvp_status));
|
||||
v.push_back(std::to_string(e.pvp_kills));
|
||||
v.push_back(std::to_string(e.pvp_deaths));
|
||||
v.push_back(std::to_string(e.pvp_current_points));
|
||||
v.push_back(std::to_string(e.pvp_career_points));
|
||||
v.push_back(std::to_string(e.pvp_best_kill_streak));
|
||||
v.push_back(std::to_string(e.pvp_worst_death_streak));
|
||||
v.push_back(std::to_string(e.pvp_current_kill_streak));
|
||||
v.push_back(std::to_string(e.pvp2));
|
||||
v.push_back(std::to_string(e.pvp_type));
|
||||
v.push_back(std::to_string(e.show_helm));
|
||||
v.push_back(std::to_string(e.group_auto_consent));
|
||||
v.push_back(std::to_string(e.raid_auto_consent));
|
||||
v.push_back(std::to_string(e.guild_auto_consent));
|
||||
v.push_back(std::to_string(e.leadership_exp_on));
|
||||
v.push_back(std::to_string(e.RestTimer));
|
||||
v.push_back(std::to_string(e.air_remaining));
|
||||
v.push_back(std::to_string(e.autosplit_enabled));
|
||||
v.push_back(std::to_string(e.lfp));
|
||||
v.push_back(std::to_string(e.lfg));
|
||||
v.push_back("'" + Strings::Escape(e.mailkey) + "'");
|
||||
v.push_back(std::to_string(e.xtargets));
|
||||
v.push_back(std::to_string(e.firstlogon));
|
||||
v.push_back(std::to_string(e.e_aa_effects));
|
||||
v.push_back(std::to_string(e.e_percent_to_aa));
|
||||
v.push_back(std::to_string(e.e_expended_aa_spent));
|
||||
v.push_back(std::to_string(e.aa_points_spent_old));
|
||||
v.push_back(std::to_string(e.aa_points_old));
|
||||
v.push_back(std::to_string(e.e_last_invsnapshot));
|
||||
v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")");
|
||||
|
||||
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<CharacterData> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.account_id));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.last_name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.title) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.suffix) + "'");
|
||||
v.push_back(std::to_string(e.zone_id));
|
||||
v.push_back(std::to_string(e.zone_instance));
|
||||
v.push_back(std::to_string(e.y));
|
||||
v.push_back(std::to_string(e.x));
|
||||
v.push_back(std::to_string(e.z));
|
||||
v.push_back(std::to_string(e.heading));
|
||||
v.push_back(std::to_string(e.gender));
|
||||
v.push_back(std::to_string(e.race));
|
||||
v.push_back(std::to_string(e.class_));
|
||||
v.push_back(std::to_string(e.level));
|
||||
v.push_back(std::to_string(e.deity));
|
||||
v.push_back(std::to_string(e.birthday));
|
||||
v.push_back(std::to_string(e.last_login));
|
||||
v.push_back(std::to_string(e.time_played));
|
||||
v.push_back(std::to_string(e.level2));
|
||||
v.push_back(std::to_string(e.anon));
|
||||
v.push_back(std::to_string(e.gm));
|
||||
v.push_back(std::to_string(e.face));
|
||||
v.push_back(std::to_string(e.hair_color));
|
||||
v.push_back(std::to_string(e.hair_style));
|
||||
v.push_back(std::to_string(e.beard));
|
||||
v.push_back(std::to_string(e.beard_color));
|
||||
v.push_back(std::to_string(e.eye_color_1));
|
||||
v.push_back(std::to_string(e.eye_color_2));
|
||||
v.push_back(std::to_string(e.drakkin_heritage));
|
||||
v.push_back(std::to_string(e.drakkin_tattoo));
|
||||
v.push_back(std::to_string(e.drakkin_details));
|
||||
v.push_back(std::to_string(e.ability_time_seconds));
|
||||
v.push_back(std::to_string(e.ability_number));
|
||||
v.push_back(std::to_string(e.ability_time_minutes));
|
||||
v.push_back(std::to_string(e.ability_time_hours));
|
||||
v.push_back(std::to_string(e.exp));
|
||||
v.push_back(std::to_string(e.exp_enabled));
|
||||
v.push_back(std::to_string(e.aa_points_spent));
|
||||
v.push_back(std::to_string(e.aa_exp));
|
||||
v.push_back(std::to_string(e.aa_points));
|
||||
v.push_back(std::to_string(e.group_leadership_exp));
|
||||
v.push_back(std::to_string(e.raid_leadership_exp));
|
||||
v.push_back(std::to_string(e.group_leadership_points));
|
||||
v.push_back(std::to_string(e.raid_leadership_points));
|
||||
v.push_back(std::to_string(e.points));
|
||||
v.push_back(std::to_string(e.cur_hp));
|
||||
v.push_back(std::to_string(e.mana));
|
||||
v.push_back(std::to_string(e.endurance));
|
||||
v.push_back(std::to_string(e.intoxication));
|
||||
v.push_back(std::to_string(e.str));
|
||||
v.push_back(std::to_string(e.sta));
|
||||
v.push_back(std::to_string(e.cha));
|
||||
v.push_back(std::to_string(e.dex));
|
||||
v.push_back(std::to_string(e.int_));
|
||||
v.push_back(std::to_string(e.agi));
|
||||
v.push_back(std::to_string(e.wis));
|
||||
v.push_back(std::to_string(e.zone_change_count));
|
||||
v.push_back(std::to_string(e.toxicity));
|
||||
v.push_back(std::to_string(e.hunger_level));
|
||||
v.push_back(std::to_string(e.thirst_level));
|
||||
v.push_back(std::to_string(e.ability_up));
|
||||
v.push_back(std::to_string(e.ldon_points_guk));
|
||||
v.push_back(std::to_string(e.ldon_points_mir));
|
||||
v.push_back(std::to_string(e.ldon_points_mmc));
|
||||
v.push_back(std::to_string(e.ldon_points_ruj));
|
||||
v.push_back(std::to_string(e.ldon_points_tak));
|
||||
v.push_back(std::to_string(e.ldon_points_available));
|
||||
v.push_back(std::to_string(e.tribute_time_remaining));
|
||||
v.push_back(std::to_string(e.career_tribute_points));
|
||||
v.push_back(std::to_string(e.tribute_points));
|
||||
v.push_back(std::to_string(e.tribute_active));
|
||||
v.push_back(std::to_string(e.pvp_status));
|
||||
v.push_back(std::to_string(e.pvp_kills));
|
||||
v.push_back(std::to_string(e.pvp_deaths));
|
||||
v.push_back(std::to_string(e.pvp_current_points));
|
||||
v.push_back(std::to_string(e.pvp_career_points));
|
||||
v.push_back(std::to_string(e.pvp_best_kill_streak));
|
||||
v.push_back(std::to_string(e.pvp_worst_death_streak));
|
||||
v.push_back(std::to_string(e.pvp_current_kill_streak));
|
||||
v.push_back(std::to_string(e.pvp2));
|
||||
v.push_back(std::to_string(e.pvp_type));
|
||||
v.push_back(std::to_string(e.show_helm));
|
||||
v.push_back(std::to_string(e.group_auto_consent));
|
||||
v.push_back(std::to_string(e.raid_auto_consent));
|
||||
v.push_back(std::to_string(e.guild_auto_consent));
|
||||
v.push_back(std::to_string(e.leadership_exp_on));
|
||||
v.push_back(std::to_string(e.RestTimer));
|
||||
v.push_back(std::to_string(e.air_remaining));
|
||||
v.push_back(std::to_string(e.autosplit_enabled));
|
||||
v.push_back(std::to_string(e.lfp));
|
||||
v.push_back(std::to_string(e.lfg));
|
||||
v.push_back("'" + Strings::Escape(e.mailkey) + "'");
|
||||
v.push_back(std::to_string(e.xtargets));
|
||||
v.push_back(std::to_string(e.firstlogon));
|
||||
v.push_back(std::to_string(e.e_aa_effects));
|
||||
v.push_back(std::to_string(e.e_percent_to_aa));
|
||||
v.push_back(std::to_string(e.e_expended_aa_spent));
|
||||
v.push_back(std::to_string(e.aa_points_spent_old));
|
||||
v.push_back(std::to_string(e.aa_points_old));
|
||||
v.push_back(std::to_string(e.e_last_invsnapshot));
|
||||
v.push_back("FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")");
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_DATA_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_DISCIPLINES_REPOSITORY_H
|
||||
@@ -112,8 +112,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_disciplines_id
|
||||
)
|
||||
);
|
||||
@@ -122,9 +123,9 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterDisciplines e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.slot_id = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.disc_id = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.slot_id = row[1] ? static_cast<uint16_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.disc_id = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -250,9 +251,9 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterDisciplines e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.slot_id = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.disc_id = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.slot_id = row[1] ? static_cast<uint16_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.disc_id = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -277,9 +278,9 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterDisciplines e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.slot_id = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.disc_id = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.slot_id = row[1] ? static_cast<uint16_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.disc_id = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -338,6 +339,66 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterDisciplines &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.slot_id));
|
||||
v.push_back(std::to_string(e.disc_id));
|
||||
|
||||
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<CharacterDisciplines> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.slot_id));
|
||||
v.push_back(std::to_string(e.disc_id));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_DISCIPLINES_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_EXP_MODIFIERS_REPOSITORY_H
|
||||
@@ -120,8 +120,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_exp_modifiers_id
|
||||
)
|
||||
);
|
||||
@@ -130,11 +131,11 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterExpModifiers e{};
|
||||
|
||||
e.character_id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.zone_id = static_cast<int32_t>(atoi(row[1]));
|
||||
e.instance_version = static_cast<int32_t>(atoi(row[2]));
|
||||
e.aa_modifier = strtof(row[3], nullptr);
|
||||
e.exp_modifier = strtof(row[4], nullptr);
|
||||
e.character_id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.zone_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.instance_version = row[2] ? static_cast<int32_t>(atoi(row[2])) : -1;
|
||||
e.aa_modifier = row[3] ? strtof(row[3], nullptr) : 0;
|
||||
e.exp_modifier = row[4] ? strtof(row[4], nullptr) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -266,11 +267,11 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterExpModifiers e{};
|
||||
|
||||
e.character_id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.zone_id = static_cast<int32_t>(atoi(row[1]));
|
||||
e.instance_version = static_cast<int32_t>(atoi(row[2]));
|
||||
e.aa_modifier = strtof(row[3], nullptr);
|
||||
e.exp_modifier = strtof(row[4], nullptr);
|
||||
e.character_id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.zone_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.instance_version = row[2] ? static_cast<int32_t>(atoi(row[2])) : -1;
|
||||
e.aa_modifier = row[3] ? strtof(row[3], nullptr) : 0;
|
||||
e.exp_modifier = row[4] ? strtof(row[4], nullptr) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -295,11 +296,11 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterExpModifiers e{};
|
||||
|
||||
e.character_id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.zone_id = static_cast<int32_t>(atoi(row[1]));
|
||||
e.instance_version = static_cast<int32_t>(atoi(row[2]));
|
||||
e.aa_modifier = strtof(row[3], nullptr);
|
||||
e.exp_modifier = strtof(row[4], nullptr);
|
||||
e.character_id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.zone_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.instance_version = row[2] ? static_cast<int32_t>(atoi(row[2])) : -1;
|
||||
e.aa_modifier = row[3] ? strtof(row[3], nullptr) : 0;
|
||||
e.exp_modifier = row[4] ? strtof(row[4], nullptr) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -358,6 +359,70 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterExpModifiers &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.character_id));
|
||||
v.push_back(std::to_string(e.zone_id));
|
||||
v.push_back(std::to_string(e.instance_version));
|
||||
v.push_back(std::to_string(e.aa_modifier));
|
||||
v.push_back(std::to_string(e.exp_modifier));
|
||||
|
||||
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<CharacterExpModifiers> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.character_id));
|
||||
v.push_back(std::to_string(e.zone_id));
|
||||
v.push_back(std::to_string(e.instance_version));
|
||||
v.push_back(std::to_string(e.aa_modifier));
|
||||
v.push_back(std::to_string(e.exp_modifier));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_EXP_MODIFIERS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_EXPEDITION_LOCKOUTS_REPOSITORY_H
|
||||
@@ -128,8 +128,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_expedition_lockouts_id
|
||||
)
|
||||
);
|
||||
@@ -138,12 +139,12 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterExpeditionLockouts e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.character_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.character_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.expedition_name = row[2] ? row[2] : "";
|
||||
e.event_name = row[3] ? row[3] : "";
|
||||
e.expire_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
|
||||
e.duration = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.duration = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.from_expedition_uuid = row[6] ? row[6] : "";
|
||||
|
||||
return e;
|
||||
@@ -281,12 +282,12 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterExpeditionLockouts e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.character_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.character_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.expedition_name = row[2] ? row[2] : "";
|
||||
e.event_name = row[3] ? row[3] : "";
|
||||
e.expire_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
|
||||
e.duration = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.duration = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.from_expedition_uuid = row[6] ? row[6] : "";
|
||||
|
||||
all_entries.push_back(e);
|
||||
@@ -312,12 +313,12 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterExpeditionLockouts e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.character_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.character_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.expedition_name = row[2] ? row[2] : "";
|
||||
e.event_name = row[3] ? row[3] : "";
|
||||
e.expire_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
|
||||
e.duration = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.duration = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.from_expedition_uuid = row[6] ? row[6] : "";
|
||||
|
||||
all_entries.push_back(e);
|
||||
@@ -377,6 +378,74 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterExpeditionLockouts &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.character_id));
|
||||
v.push_back("'" + Strings::Escape(e.expedition_name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.event_name) + "'");
|
||||
v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")");
|
||||
v.push_back(std::to_string(e.duration));
|
||||
v.push_back("'" + Strings::Escape(e.from_expedition_uuid) + "'");
|
||||
|
||||
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<CharacterExpeditionLockouts> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.character_id));
|
||||
v.push_back("'" + Strings::Escape(e.expedition_name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.event_name) + "'");
|
||||
v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")");
|
||||
v.push_back(std::to_string(e.duration));
|
||||
v.push_back("'" + Strings::Escape(e.from_expedition_uuid) + "'");
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_EXPEDITION_LOCKOUTS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_INSPECT_MESSAGES_REPOSITORY_H
|
||||
@@ -108,8 +108,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_inspect_messages_id
|
||||
)
|
||||
);
|
||||
@@ -118,7 +119,7 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterInspectMessages e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.inspect_message = row[1] ? row[1] : "";
|
||||
|
||||
return e;
|
||||
@@ -242,7 +243,7 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterInspectMessages e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.inspect_message = row[1] ? row[1] : "";
|
||||
|
||||
all_entries.push_back(e);
|
||||
@@ -268,7 +269,7 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterInspectMessages e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.inspect_message = row[1] ? row[1] : "";
|
||||
|
||||
all_entries.push_back(e);
|
||||
@@ -328,6 +329,64 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterInspectMessages &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back("'" + Strings::Escape(e.inspect_message) + "'");
|
||||
|
||||
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<CharacterInspectMessages> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back("'" + Strings::Escape(e.inspect_message) + "'");
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_INSPECT_MESSAGES_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_INSTANCE_SAFERETURNS_REPOSITORY_H
|
||||
@@ -136,8 +136,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_instance_safereturns_id
|
||||
)
|
||||
);
|
||||
@@ -146,15 +147,15 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterInstanceSafereturns e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.character_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.instance_zone_id = static_cast<int32_t>(atoi(row[2]));
|
||||
e.instance_id = static_cast<int32_t>(atoi(row[3]));
|
||||
e.safe_zone_id = static_cast<int32_t>(atoi(row[4]));
|
||||
e.safe_x = strtof(row[5], nullptr);
|
||||
e.safe_y = strtof(row[6], nullptr);
|
||||
e.safe_z = strtof(row[7], nullptr);
|
||||
e.safe_heading = strtof(row[8], nullptr);
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.character_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.instance_zone_id = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
e.instance_id = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
e.safe_zone_id = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||
e.safe_x = row[5] ? strtof(row[5], nullptr) : 0;
|
||||
e.safe_y = row[6] ? strtof(row[6], nullptr) : 0;
|
||||
e.safe_z = row[7] ? strtof(row[7], nullptr) : 0;
|
||||
e.safe_heading = row[8] ? strtof(row[8], nullptr) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -297,15 +298,15 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterInstanceSafereturns e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.character_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.instance_zone_id = static_cast<int32_t>(atoi(row[2]));
|
||||
e.instance_id = static_cast<int32_t>(atoi(row[3]));
|
||||
e.safe_zone_id = static_cast<int32_t>(atoi(row[4]));
|
||||
e.safe_x = strtof(row[5], nullptr);
|
||||
e.safe_y = strtof(row[6], nullptr);
|
||||
e.safe_z = strtof(row[7], nullptr);
|
||||
e.safe_heading = strtof(row[8], nullptr);
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.character_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.instance_zone_id = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
e.instance_id = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
e.safe_zone_id = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||
e.safe_x = row[5] ? strtof(row[5], nullptr) : 0;
|
||||
e.safe_y = row[6] ? strtof(row[6], nullptr) : 0;
|
||||
e.safe_z = row[7] ? strtof(row[7], nullptr) : 0;
|
||||
e.safe_heading = row[8] ? strtof(row[8], nullptr) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -330,15 +331,15 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterInstanceSafereturns e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.character_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.instance_zone_id = static_cast<int32_t>(atoi(row[2]));
|
||||
e.instance_id = static_cast<int32_t>(atoi(row[3]));
|
||||
e.safe_zone_id = static_cast<int32_t>(atoi(row[4]));
|
||||
e.safe_x = strtof(row[5], nullptr);
|
||||
e.safe_y = strtof(row[6], nullptr);
|
||||
e.safe_z = strtof(row[7], nullptr);
|
||||
e.safe_heading = strtof(row[8], nullptr);
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.character_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.instance_zone_id = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
e.instance_id = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
e.safe_zone_id = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||
e.safe_x = row[5] ? strtof(row[5], nullptr) : 0;
|
||||
e.safe_y = row[6] ? strtof(row[6], nullptr) : 0;
|
||||
e.safe_z = row[7] ? strtof(row[7], nullptr) : 0;
|
||||
e.safe_heading = row[8] ? strtof(row[8], nullptr) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -397,6 +398,78 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterInstanceSafereturns &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.character_id));
|
||||
v.push_back(std::to_string(e.instance_zone_id));
|
||||
v.push_back(std::to_string(e.instance_id));
|
||||
v.push_back(std::to_string(e.safe_zone_id));
|
||||
v.push_back(std::to_string(e.safe_x));
|
||||
v.push_back(std::to_string(e.safe_y));
|
||||
v.push_back(std::to_string(e.safe_z));
|
||||
v.push_back(std::to_string(e.safe_heading));
|
||||
|
||||
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<CharacterInstanceSafereturns> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.character_id));
|
||||
v.push_back(std::to_string(e.instance_zone_id));
|
||||
v.push_back(std::to_string(e.instance_id));
|
||||
v.push_back(std::to_string(e.safe_zone_id));
|
||||
v.push_back(std::to_string(e.safe_x));
|
||||
v.push_back(std::to_string(e.safe_y));
|
||||
v.push_back(std::to_string(e.safe_z));
|
||||
v.push_back(std::to_string(e.safe_heading));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_INSTANCE_SAFERETURNS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_ITEM_RECAST_REPOSITORY_H
|
||||
@@ -20,7 +20,7 @@ class BaseCharacterItemRecastRepository {
|
||||
public:
|
||||
struct CharacterItemRecast {
|
||||
uint32_t id;
|
||||
uint16_t recast_type;
|
||||
uint32_t recast_type;
|
||||
uint32_t timestamp;
|
||||
};
|
||||
|
||||
@@ -112,8 +112,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_item_recast_id
|
||||
)
|
||||
);
|
||||
@@ -122,9 +123,9 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterItemRecast e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.recast_type = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.timestamp = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.recast_type = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.timestamp = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -250,9 +251,9 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterItemRecast e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.recast_type = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.timestamp = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.recast_type = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.timestamp = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -277,9 +278,9 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterItemRecast e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.recast_type = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.timestamp = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.recast_type = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.timestamp = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -338,6 +339,66 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterItemRecast &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.recast_type));
|
||||
v.push_back(std::to_string(e.timestamp));
|
||||
|
||||
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<CharacterItemRecast> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.recast_type));
|
||||
v.push_back(std::to_string(e.timestamp));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_ITEM_RECAST_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_LANGUAGES_REPOSITORY_H
|
||||
@@ -112,8 +112,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_languages_id
|
||||
)
|
||||
);
|
||||
@@ -122,9 +123,9 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterLanguages e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.lang_id = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.value = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.lang_id = row[1] ? static_cast<uint16_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.value = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -249,9 +250,9 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterLanguages e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.lang_id = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.value = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.lang_id = row[1] ? static_cast<uint16_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.value = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -276,9 +277,9 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterLanguages e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.lang_id = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.value = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.lang_id = row[1] ? static_cast<uint16_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.value = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -337,6 +338,66 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterLanguages &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.lang_id));
|
||||
v.push_back(std::to_string(e.value));
|
||||
|
||||
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<CharacterLanguages> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.lang_id));
|
||||
v.push_back(std::to_string(e.value));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_LANGUAGES_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_LEADERSHIP_ABILITIES_REPOSITORY_H
|
||||
@@ -21,7 +21,7 @@ public:
|
||||
struct CharacterLeadershipAbilities {
|
||||
uint32_t id;
|
||||
uint16_t slot;
|
||||
uint16_t rank;
|
||||
uint16_t rank_;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
@@ -34,7 +34,7 @@ public:
|
||||
return {
|
||||
"id",
|
||||
"slot",
|
||||
"rank",
|
||||
"`rank`",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
return {
|
||||
"id",
|
||||
"slot",
|
||||
"rank",
|
||||
"`rank`",
|
||||
};
|
||||
}
|
||||
|
||||
@@ -84,9 +84,9 @@ public:
|
||||
{
|
||||
CharacterLeadershipAbilities e{};
|
||||
|
||||
e.id = 0;
|
||||
e.slot = 0;
|
||||
e.rank = 0;
|
||||
e.id = 0;
|
||||
e.slot = 0;
|
||||
e.rank_ = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -112,8 +112,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_leadership_abilities_id
|
||||
)
|
||||
);
|
||||
@@ -122,9 +123,9 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterLeadershipAbilities e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.slot = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.rank = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.slot = row[1] ? static_cast<uint16_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.rank_ = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -160,7 +161,7 @@ public:
|
||||
|
||||
v.push_back(columns[0] + " = " + std::to_string(e.id));
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.slot));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.rank));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.rank_));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -184,7 +185,7 @@ public:
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.slot));
|
||||
v.push_back(std::to_string(e.rank));
|
||||
v.push_back(std::to_string(e.rank_));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@@ -216,7 +217,7 @@ public:
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.slot));
|
||||
v.push_back(std::to_string(e.rank));
|
||||
v.push_back(std::to_string(e.rank_));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
@@ -250,9 +251,9 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterLeadershipAbilities e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.slot = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.rank = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.slot = row[1] ? static_cast<uint16_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.rank_ = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -277,9 +278,9 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterLeadershipAbilities e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.slot = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.rank = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.slot = row[1] ? static_cast<uint16_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.rank_ = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -338,6 +339,66 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterLeadershipAbilities &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.slot));
|
||||
v.push_back(std::to_string(e.rank_));
|
||||
|
||||
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<CharacterLeadershipAbilities> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.slot));
|
||||
v.push_back(std::to_string(e.rank_));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_LEADERSHIP_ABILITIES_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_MATERIAL_REPOSITORY_H
|
||||
@@ -128,8 +128,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_material_id
|
||||
)
|
||||
);
|
||||
@@ -138,13 +139,13 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterMaterial e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.slot = static_cast<uint8_t>(strtoul(row[1], nullptr, 10));
|
||||
e.blue = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.green = static_cast<uint8_t>(strtoul(row[3], nullptr, 10));
|
||||
e.red = static_cast<uint8_t>(strtoul(row[4], nullptr, 10));
|
||||
e.use_tint = static_cast<uint8_t>(strtoul(row[5], nullptr, 10));
|
||||
e.color = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.slot = row[1] ? static_cast<uint8_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.blue = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.green = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.red = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.use_tint = row[5] ? static_cast<uint8_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.color = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -281,13 +282,13 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterMaterial e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.slot = static_cast<uint8_t>(strtoul(row[1], nullptr, 10));
|
||||
e.blue = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.green = static_cast<uint8_t>(strtoul(row[3], nullptr, 10));
|
||||
e.red = static_cast<uint8_t>(strtoul(row[4], nullptr, 10));
|
||||
e.use_tint = static_cast<uint8_t>(strtoul(row[5], nullptr, 10));
|
||||
e.color = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.slot = row[1] ? static_cast<uint8_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.blue = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.green = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.red = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.use_tint = row[5] ? static_cast<uint8_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.color = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -312,13 +313,13 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterMaterial e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.slot = static_cast<uint8_t>(strtoul(row[1], nullptr, 10));
|
||||
e.blue = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.green = static_cast<uint8_t>(strtoul(row[3], nullptr, 10));
|
||||
e.red = static_cast<uint8_t>(strtoul(row[4], nullptr, 10));
|
||||
e.use_tint = static_cast<uint8_t>(strtoul(row[5], nullptr, 10));
|
||||
e.color = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.slot = row[1] ? static_cast<uint8_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.blue = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.green = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.red = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.use_tint = row[5] ? static_cast<uint8_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.color = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -377,6 +378,74 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterMaterial &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.slot));
|
||||
v.push_back(std::to_string(e.blue));
|
||||
v.push_back(std::to_string(e.green));
|
||||
v.push_back(std::to_string(e.red));
|
||||
v.push_back(std::to_string(e.use_tint));
|
||||
v.push_back(std::to_string(e.color));
|
||||
|
||||
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<CharacterMaterial> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.slot));
|
||||
v.push_back(std::to_string(e.blue));
|
||||
v.push_back(std::to_string(e.green));
|
||||
v.push_back(std::to_string(e.red));
|
||||
v.push_back(std::to_string(e.use_tint));
|
||||
v.push_back(std::to_string(e.color));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_MATERIAL_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_MEMMED_SPELLS_REPOSITORY_H
|
||||
@@ -112,8 +112,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_memmed_spells_id
|
||||
)
|
||||
);
|
||||
@@ -122,9 +123,9 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterMemmedSpells e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.slot_id = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.spell_id = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.slot_id = row[1] ? static_cast<uint16_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.spell_id = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -250,9 +251,9 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterMemmedSpells e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.slot_id = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.spell_id = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.slot_id = row[1] ? static_cast<uint16_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.spell_id = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -277,9 +278,9 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterMemmedSpells e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.slot_id = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.spell_id = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.slot_id = row[1] ? static_cast<uint16_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.spell_id = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -338,6 +339,66 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterMemmedSpells &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.slot_id));
|
||||
v.push_back(std::to_string(e.spell_id));
|
||||
|
||||
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<CharacterMemmedSpells> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.slot_id));
|
||||
v.push_back(std::to_string(e.spell_id));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_MEMMED_SPELLS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_PEQZONE_FLAGS_REPOSITORY_H
|
||||
@@ -108,8 +108,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_peqzone_flags_id
|
||||
)
|
||||
);
|
||||
@@ -118,8 +119,8 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterPeqzoneFlags e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.zone_id = static_cast<int32_t>(atoi(row[1]));
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.zone_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -242,8 +243,8 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterPeqzoneFlags e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.zone_id = static_cast<int32_t>(atoi(row[1]));
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.zone_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -268,8 +269,8 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterPeqzoneFlags e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.zone_id = static_cast<int32_t>(atoi(row[1]));
|
||||
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.zone_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -328,6 +329,64 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterPeqzoneFlags &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.zone_id));
|
||||
|
||||
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<CharacterPeqzoneFlags> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.zone_id));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_PEQZONE_FLAGS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_PET_BUFFS_REPOSITORY_H
|
||||
@@ -144,8 +144,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_pet_buffs_id
|
||||
)
|
||||
);
|
||||
@@ -154,17 +155,17 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterPetBuffs e{};
|
||||
|
||||
e.char_id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.pet = static_cast<int32_t>(atoi(row[1]));
|
||||
e.slot = static_cast<int32_t>(atoi(row[2]));
|
||||
e.spell_id = static_cast<int32_t>(atoi(row[3]));
|
||||
e.caster_level = static_cast<int8_t>(atoi(row[4]));
|
||||
e.char_id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.pet = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.slot = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
e.spell_id = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
e.caster_level = row[4] ? static_cast<int8_t>(atoi(row[4])) : 0;
|
||||
e.castername = row[5] ? row[5] : "";
|
||||
e.ticsremaining = static_cast<int32_t>(atoi(row[6]));
|
||||
e.counters = static_cast<int32_t>(atoi(row[7]));
|
||||
e.numhits = static_cast<int32_t>(atoi(row[8]));
|
||||
e.rune = static_cast<int32_t>(atoi(row[9]));
|
||||
e.instrument_mod = static_cast<uint8_t>(strtoul(row[10], nullptr, 10));
|
||||
e.ticsremaining = row[6] ? static_cast<int32_t>(atoi(row[6])) : 0;
|
||||
e.counters = row[7] ? static_cast<int32_t>(atoi(row[7])) : 0;
|
||||
e.numhits = row[8] ? static_cast<int32_t>(atoi(row[8])) : 0;
|
||||
e.rune = row[9] ? static_cast<int32_t>(atoi(row[9])) : 0;
|
||||
e.instrument_mod = row[10] ? static_cast<uint8_t>(strtoul(row[10], nullptr, 10)) : 10;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -314,17 +315,17 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterPetBuffs e{};
|
||||
|
||||
e.char_id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.pet = static_cast<int32_t>(atoi(row[1]));
|
||||
e.slot = static_cast<int32_t>(atoi(row[2]));
|
||||
e.spell_id = static_cast<int32_t>(atoi(row[3]));
|
||||
e.caster_level = static_cast<int8_t>(atoi(row[4]));
|
||||
e.char_id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.pet = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.slot = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
e.spell_id = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
e.caster_level = row[4] ? static_cast<int8_t>(atoi(row[4])) : 0;
|
||||
e.castername = row[5] ? row[5] : "";
|
||||
e.ticsremaining = static_cast<int32_t>(atoi(row[6]));
|
||||
e.counters = static_cast<int32_t>(atoi(row[7]));
|
||||
e.numhits = static_cast<int32_t>(atoi(row[8]));
|
||||
e.rune = static_cast<int32_t>(atoi(row[9]));
|
||||
e.instrument_mod = static_cast<uint8_t>(strtoul(row[10], nullptr, 10));
|
||||
e.ticsremaining = row[6] ? static_cast<int32_t>(atoi(row[6])) : 0;
|
||||
e.counters = row[7] ? static_cast<int32_t>(atoi(row[7])) : 0;
|
||||
e.numhits = row[8] ? static_cast<int32_t>(atoi(row[8])) : 0;
|
||||
e.rune = row[9] ? static_cast<int32_t>(atoi(row[9])) : 0;
|
||||
e.instrument_mod = row[10] ? static_cast<uint8_t>(strtoul(row[10], nullptr, 10)) : 10;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -349,17 +350,17 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterPetBuffs e{};
|
||||
|
||||
e.char_id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.pet = static_cast<int32_t>(atoi(row[1]));
|
||||
e.slot = static_cast<int32_t>(atoi(row[2]));
|
||||
e.spell_id = static_cast<int32_t>(atoi(row[3]));
|
||||
e.caster_level = static_cast<int8_t>(atoi(row[4]));
|
||||
e.char_id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.pet = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.slot = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
e.spell_id = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
e.caster_level = row[4] ? static_cast<int8_t>(atoi(row[4])) : 0;
|
||||
e.castername = row[5] ? row[5] : "";
|
||||
e.ticsremaining = static_cast<int32_t>(atoi(row[6]));
|
||||
e.counters = static_cast<int32_t>(atoi(row[7]));
|
||||
e.numhits = static_cast<int32_t>(atoi(row[8]));
|
||||
e.rune = static_cast<int32_t>(atoi(row[9]));
|
||||
e.instrument_mod = static_cast<uint8_t>(strtoul(row[10], nullptr, 10));
|
||||
e.ticsremaining = row[6] ? static_cast<int32_t>(atoi(row[6])) : 0;
|
||||
e.counters = row[7] ? static_cast<int32_t>(atoi(row[7])) : 0;
|
||||
e.numhits = row[8] ? static_cast<int32_t>(atoi(row[8])) : 0;
|
||||
e.rune = row[9] ? static_cast<int32_t>(atoi(row[9])) : 0;
|
||||
e.instrument_mod = row[10] ? static_cast<uint8_t>(strtoul(row[10], nullptr, 10)) : 10;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -418,6 +419,82 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterPetBuffs &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.char_id));
|
||||
v.push_back(std::to_string(e.pet));
|
||||
v.push_back(std::to_string(e.slot));
|
||||
v.push_back(std::to_string(e.spell_id));
|
||||
v.push_back(std::to_string(e.caster_level));
|
||||
v.push_back("'" + Strings::Escape(e.castername) + "'");
|
||||
v.push_back(std::to_string(e.ticsremaining));
|
||||
v.push_back(std::to_string(e.counters));
|
||||
v.push_back(std::to_string(e.numhits));
|
||||
v.push_back(std::to_string(e.rune));
|
||||
v.push_back(std::to_string(e.instrument_mod));
|
||||
|
||||
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<CharacterPetBuffs> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.char_id));
|
||||
v.push_back(std::to_string(e.pet));
|
||||
v.push_back(std::to_string(e.slot));
|
||||
v.push_back(std::to_string(e.spell_id));
|
||||
v.push_back(std::to_string(e.caster_level));
|
||||
v.push_back("'" + Strings::Escape(e.castername) + "'");
|
||||
v.push_back(std::to_string(e.ticsremaining));
|
||||
v.push_back(std::to_string(e.counters));
|
||||
v.push_back(std::to_string(e.numhits));
|
||||
v.push_back(std::to_string(e.rune));
|
||||
v.push_back(std::to_string(e.instrument_mod));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_PET_BUFFS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_PET_INFO_REPOSITORY_H
|
||||
@@ -136,8 +136,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_pet_info_id
|
||||
)
|
||||
);
|
||||
@@ -146,15 +147,15 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterPetInfo e{};
|
||||
|
||||
e.char_id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.pet = static_cast<int32_t>(atoi(row[1]));
|
||||
e.char_id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.pet = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.petname = row[2] ? row[2] : "";
|
||||
e.petpower = static_cast<int32_t>(atoi(row[3]));
|
||||
e.spell_id = static_cast<int32_t>(atoi(row[4]));
|
||||
e.hp = static_cast<int32_t>(atoi(row[5]));
|
||||
e.mana = static_cast<int32_t>(atoi(row[6]));
|
||||
e.size = strtof(row[7], nullptr);
|
||||
e.taunting = static_cast<int8_t>(atoi(row[8]));
|
||||
e.petpower = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
e.spell_id = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||
e.hp = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
|
||||
e.mana = row[6] ? static_cast<int32_t>(atoi(row[6])) : 0;
|
||||
e.size = row[7] ? strtof(row[7], nullptr) : 0;
|
||||
e.taunting = row[8] ? static_cast<int8_t>(atoi(row[8])) : 1;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -298,15 +299,15 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterPetInfo e{};
|
||||
|
||||
e.char_id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.pet = static_cast<int32_t>(atoi(row[1]));
|
||||
e.char_id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.pet = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.petname = row[2] ? row[2] : "";
|
||||
e.petpower = static_cast<int32_t>(atoi(row[3]));
|
||||
e.spell_id = static_cast<int32_t>(atoi(row[4]));
|
||||
e.hp = static_cast<int32_t>(atoi(row[5]));
|
||||
e.mana = static_cast<int32_t>(atoi(row[6]));
|
||||
e.size = strtof(row[7], nullptr);
|
||||
e.taunting = static_cast<int8_t>(atoi(row[8]));
|
||||
e.petpower = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
e.spell_id = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||
e.hp = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
|
||||
e.mana = row[6] ? static_cast<int32_t>(atoi(row[6])) : 0;
|
||||
e.size = row[7] ? strtof(row[7], nullptr) : 0;
|
||||
e.taunting = row[8] ? static_cast<int8_t>(atoi(row[8])) : 1;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -331,15 +332,15 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterPetInfo e{};
|
||||
|
||||
e.char_id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.pet = static_cast<int32_t>(atoi(row[1]));
|
||||
e.char_id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.pet = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.petname = row[2] ? row[2] : "";
|
||||
e.petpower = static_cast<int32_t>(atoi(row[3]));
|
||||
e.spell_id = static_cast<int32_t>(atoi(row[4]));
|
||||
e.hp = static_cast<int32_t>(atoi(row[5]));
|
||||
e.mana = static_cast<int32_t>(atoi(row[6]));
|
||||
e.size = strtof(row[7], nullptr);
|
||||
e.taunting = static_cast<int8_t>(atoi(row[8]));
|
||||
e.petpower = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
e.spell_id = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||
e.hp = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
|
||||
e.mana = row[6] ? static_cast<int32_t>(atoi(row[6])) : 0;
|
||||
e.size = row[7] ? strtof(row[7], nullptr) : 0;
|
||||
e.taunting = row[8] ? static_cast<int8_t>(atoi(row[8])) : 1;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -398,6 +399,78 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterPetInfo &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.char_id));
|
||||
v.push_back(std::to_string(e.pet));
|
||||
v.push_back("'" + Strings::Escape(e.petname) + "'");
|
||||
v.push_back(std::to_string(e.petpower));
|
||||
v.push_back(std::to_string(e.spell_id));
|
||||
v.push_back(std::to_string(e.hp));
|
||||
v.push_back(std::to_string(e.mana));
|
||||
v.push_back(std::to_string(e.size));
|
||||
v.push_back(std::to_string(e.taunting));
|
||||
|
||||
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<CharacterPetInfo> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.char_id));
|
||||
v.push_back(std::to_string(e.pet));
|
||||
v.push_back("'" + Strings::Escape(e.petname) + "'");
|
||||
v.push_back(std::to_string(e.petpower));
|
||||
v.push_back(std::to_string(e.spell_id));
|
||||
v.push_back(std::to_string(e.hp));
|
||||
v.push_back(std::to_string(e.mana));
|
||||
v.push_back(std::to_string(e.size));
|
||||
v.push_back(std::to_string(e.taunting));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_PET_INFO_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_PET_INVENTORY_REPOSITORY_H
|
||||
@@ -116,8 +116,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_pet_inventory_id
|
||||
)
|
||||
);
|
||||
@@ -126,10 +127,10 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterPetInventory e{};
|
||||
|
||||
e.char_id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.pet = static_cast<int32_t>(atoi(row[1]));
|
||||
e.slot = static_cast<int32_t>(atoi(row[2]));
|
||||
e.item_id = static_cast<int32_t>(atoi(row[3]));
|
||||
e.char_id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.pet = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.slot = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
e.item_id = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -258,10 +259,10 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterPetInventory e{};
|
||||
|
||||
e.char_id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.pet = static_cast<int32_t>(atoi(row[1]));
|
||||
e.slot = static_cast<int32_t>(atoi(row[2]));
|
||||
e.item_id = static_cast<int32_t>(atoi(row[3]));
|
||||
e.char_id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.pet = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.slot = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
e.item_id = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -286,10 +287,10 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterPetInventory e{};
|
||||
|
||||
e.char_id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.pet = static_cast<int32_t>(atoi(row[1]));
|
||||
e.slot = static_cast<int32_t>(atoi(row[2]));
|
||||
e.item_id = static_cast<int32_t>(atoi(row[3]));
|
||||
e.char_id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.pet = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
|
||||
e.slot = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
e.item_id = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -348,6 +349,68 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterPetInventory &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.char_id));
|
||||
v.push_back(std::to_string(e.pet));
|
||||
v.push_back(std::to_string(e.slot));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
|
||||
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<CharacterPetInventory> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.char_id));
|
||||
v.push_back(std::to_string(e.pet));
|
||||
v.push_back(std::to_string(e.slot));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_PET_INVENTORY_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_POTIONBELT_REPOSITORY_H
|
||||
@@ -116,8 +116,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_potionbelt_id
|
||||
)
|
||||
);
|
||||
@@ -126,10 +127,10 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterPotionbelt e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.potion_id = static_cast<uint8_t>(strtoul(row[1], nullptr, 10));
|
||||
e.item_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.icon = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.potion_id = row[1] ? static_cast<uint8_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.item_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.icon = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -258,10 +259,10 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterPotionbelt e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.potion_id = static_cast<uint8_t>(strtoul(row[1], nullptr, 10));
|
||||
e.item_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.icon = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.potion_id = row[1] ? static_cast<uint8_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.item_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.icon = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -286,10 +287,10 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterPotionbelt e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.potion_id = static_cast<uint8_t>(strtoul(row[1], nullptr, 10));
|
||||
e.item_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.icon = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.potion_id = row[1] ? static_cast<uint8_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.item_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.icon = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -348,6 +349,68 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterPotionbelt &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.potion_id));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.icon));
|
||||
|
||||
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<CharacterPotionbelt> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.potion_id));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.icon));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_POTIONBELT_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_SKILLS_REPOSITORY_H
|
||||
@@ -112,8 +112,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_skills_id
|
||||
)
|
||||
);
|
||||
@@ -122,9 +123,9 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterSkills e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.skill_id = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.value = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.skill_id = row[1] ? static_cast<uint16_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.value = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -249,9 +250,9 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterSkills e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.skill_id = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.value = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.skill_id = row[1] ? static_cast<uint16_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.value = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -276,9 +277,9 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterSkills e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.skill_id = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.value = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.skill_id = row[1] ? static_cast<uint16_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.value = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -337,6 +338,66 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterSkills &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.skill_id));
|
||||
v.push_back(std::to_string(e.value));
|
||||
|
||||
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<CharacterSkills> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.skill_id));
|
||||
v.push_back(std::to_string(e.value));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_SKILLS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_SPELLS_REPOSITORY_H
|
||||
@@ -112,8 +112,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_spells_id
|
||||
)
|
||||
);
|
||||
@@ -122,9 +123,9 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterSpells e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.slot_id = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.spell_id = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.slot_id = row[1] ? static_cast<uint16_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.spell_id = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -249,9 +250,9 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterSpells e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.slot_id = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.spell_id = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.slot_id = row[1] ? static_cast<uint16_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.spell_id = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -276,9 +277,9 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterSpells e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.slot_id = static_cast<uint16_t>(strtoul(row[1], nullptr, 10));
|
||||
e.spell_id = static_cast<uint16_t>(strtoul(row[2], nullptr, 10));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.slot_id = row[1] ? static_cast<uint16_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.spell_id = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -337,6 +338,66 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterSpells &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.slot_id));
|
||||
v.push_back(std::to_string(e.spell_id));
|
||||
|
||||
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<CharacterSpells> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.slot_id));
|
||||
v.push_back(std::to_string(e.spell_id));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_SPELLS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_STATS_RECORD_REPOSITORY_H
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
class BaseCharacterStatsRecordRepository {
|
||||
public:
|
||||
struct CharacterStatsRecord {
|
||||
@@ -408,78 +407,78 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterStatsRecord e{};
|
||||
|
||||
e.character_id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.character_id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.status = static_cast<int32_t>(atoi(row[2]));
|
||||
e.level = static_cast<int32_t>(atoi(row[3]));
|
||||
e.class_ = static_cast<int32_t>(atoi(row[4]));
|
||||
e.race = static_cast<int32_t>(atoi(row[5]));
|
||||
e.aa_points = static_cast<int32_t>(atoi(row[6]));
|
||||
e.hp = strtoll(row[7], nullptr, 10);
|
||||
e.mana = strtoll(row[8], nullptr, 10);
|
||||
e.endurance = strtoll(row[9], nullptr, 10);
|
||||
e.ac = static_cast<int32_t>(atoi(row[10]));
|
||||
e.strength = static_cast<int32_t>(atoi(row[11]));
|
||||
e.stamina = static_cast<int32_t>(atoi(row[12]));
|
||||
e.dexterity = static_cast<int32_t>(atoi(row[13]));
|
||||
e.agility = static_cast<int32_t>(atoi(row[14]));
|
||||
e.intelligence = static_cast<int32_t>(atoi(row[15]));
|
||||
e.wisdom = static_cast<int32_t>(atoi(row[16]));
|
||||
e.charisma = static_cast<int32_t>(atoi(row[17]));
|
||||
e.magic_resist = static_cast<int32_t>(atoi(row[18]));
|
||||
e.fire_resist = static_cast<int32_t>(atoi(row[19]));
|
||||
e.cold_resist = static_cast<int32_t>(atoi(row[20]));
|
||||
e.poison_resist = static_cast<int32_t>(atoi(row[21]));
|
||||
e.disease_resist = static_cast<int32_t>(atoi(row[22]));
|
||||
e.corruption_resist = static_cast<int32_t>(atoi(row[23]));
|
||||
e.heroic_strength = static_cast<int32_t>(atoi(row[24]));
|
||||
e.heroic_stamina = static_cast<int32_t>(atoi(row[25]));
|
||||
e.heroic_dexterity = static_cast<int32_t>(atoi(row[26]));
|
||||
e.heroic_agility = static_cast<int32_t>(atoi(row[27]));
|
||||
e.heroic_intelligence = static_cast<int32_t>(atoi(row[28]));
|
||||
e.heroic_wisdom = static_cast<int32_t>(atoi(row[29]));
|
||||
e.heroic_charisma = static_cast<int32_t>(atoi(row[30]));
|
||||
e.heroic_magic_resist = static_cast<int32_t>(atoi(row[31]));
|
||||
e.heroic_fire_resist = static_cast<int32_t>(atoi(row[32]));
|
||||
e.heroic_cold_resist = static_cast<int32_t>(atoi(row[33]));
|
||||
e.heroic_poison_resist = static_cast<int32_t>(atoi(row[34]));
|
||||
e.heroic_disease_resist = static_cast<int32_t>(atoi(row[35]));
|
||||
e.heroic_corruption_resist = static_cast<int32_t>(atoi(row[36]));
|
||||
e.haste = static_cast<int32_t>(atoi(row[37]));
|
||||
e.accuracy = static_cast<int32_t>(atoi(row[38]));
|
||||
e.attack = static_cast<int32_t>(atoi(row[39]));
|
||||
e.avoidance = static_cast<int32_t>(atoi(row[40]));
|
||||
e.clairvoyance = static_cast<int32_t>(atoi(row[41]));
|
||||
e.combat_effects = static_cast<int32_t>(atoi(row[42]));
|
||||
e.damage_shield_mitigation = static_cast<int32_t>(atoi(row[43]));
|
||||
e.damage_shield = static_cast<int32_t>(atoi(row[44]));
|
||||
e.dot_shielding = static_cast<int32_t>(atoi(row[45]));
|
||||
e.hp_regen = static_cast<int32_t>(atoi(row[46]));
|
||||
e.mana_regen = static_cast<int32_t>(atoi(row[47]));
|
||||
e.endurance_regen = static_cast<int32_t>(atoi(row[48]));
|
||||
e.shielding = static_cast<int32_t>(atoi(row[49]));
|
||||
e.spell_damage = static_cast<int32_t>(atoi(row[50]));
|
||||
e.spell_shielding = static_cast<int32_t>(atoi(row[51]));
|
||||
e.strikethrough = static_cast<int32_t>(atoi(row[52]));
|
||||
e.stun_resist = static_cast<int32_t>(atoi(row[53]));
|
||||
e.backstab = static_cast<int32_t>(atoi(row[54]));
|
||||
e.wind = static_cast<int32_t>(atoi(row[55]));
|
||||
e.brass = static_cast<int32_t>(atoi(row[56]));
|
||||
e.string = static_cast<int32_t>(atoi(row[57]));
|
||||
e.percussion = static_cast<int32_t>(atoi(row[58]));
|
||||
e.singing = static_cast<int32_t>(atoi(row[59]));
|
||||
e.baking = static_cast<int32_t>(atoi(row[60]));
|
||||
e.alchemy = static_cast<int32_t>(atoi(row[61]));
|
||||
e.tailoring = static_cast<int32_t>(atoi(row[62]));
|
||||
e.blacksmithing = static_cast<int32_t>(atoi(row[63]));
|
||||
e.fletching = static_cast<int32_t>(atoi(row[64]));
|
||||
e.brewing = static_cast<int32_t>(atoi(row[65]));
|
||||
e.jewelry = static_cast<int32_t>(atoi(row[66]));
|
||||
e.pottery = static_cast<int32_t>(atoi(row[67]));
|
||||
e.research = static_cast<int32_t>(atoi(row[68]));
|
||||
e.alcohol = static_cast<int32_t>(atoi(row[69]));
|
||||
e.fishing = static_cast<int32_t>(atoi(row[70]));
|
||||
e.tinkering = static_cast<int32_t>(atoi(row[71]));
|
||||
e.status = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
e.level = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
e.class_ = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||
e.race = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
|
||||
e.aa_points = row[6] ? static_cast<int32_t>(atoi(row[6])) : 0;
|
||||
e.hp = row[7] ? strtoll(row[7], nullptr, 10) : 0;
|
||||
e.mana = row[8] ? strtoll(row[8], nullptr, 10) : 0;
|
||||
e.endurance = row[9] ? strtoll(row[9], nullptr, 10) : 0;
|
||||
e.ac = row[10] ? static_cast<int32_t>(atoi(row[10])) : 0;
|
||||
e.strength = row[11] ? static_cast<int32_t>(atoi(row[11])) : 0;
|
||||
e.stamina = row[12] ? static_cast<int32_t>(atoi(row[12])) : 0;
|
||||
e.dexterity = row[13] ? static_cast<int32_t>(atoi(row[13])) : 0;
|
||||
e.agility = row[14] ? static_cast<int32_t>(atoi(row[14])) : 0;
|
||||
e.intelligence = row[15] ? static_cast<int32_t>(atoi(row[15])) : 0;
|
||||
e.wisdom = row[16] ? static_cast<int32_t>(atoi(row[16])) : 0;
|
||||
e.charisma = row[17] ? static_cast<int32_t>(atoi(row[17])) : 0;
|
||||
e.magic_resist = row[18] ? static_cast<int32_t>(atoi(row[18])) : 0;
|
||||
e.fire_resist = row[19] ? static_cast<int32_t>(atoi(row[19])) : 0;
|
||||
e.cold_resist = row[20] ? static_cast<int32_t>(atoi(row[20])) : 0;
|
||||
e.poison_resist = row[21] ? static_cast<int32_t>(atoi(row[21])) : 0;
|
||||
e.disease_resist = row[22] ? static_cast<int32_t>(atoi(row[22])) : 0;
|
||||
e.corruption_resist = row[23] ? static_cast<int32_t>(atoi(row[23])) : 0;
|
||||
e.heroic_strength = row[24] ? static_cast<int32_t>(atoi(row[24])) : 0;
|
||||
e.heroic_stamina = row[25] ? static_cast<int32_t>(atoi(row[25])) : 0;
|
||||
e.heroic_dexterity = row[26] ? static_cast<int32_t>(atoi(row[26])) : 0;
|
||||
e.heroic_agility = row[27] ? static_cast<int32_t>(atoi(row[27])) : 0;
|
||||
e.heroic_intelligence = row[28] ? static_cast<int32_t>(atoi(row[28])) : 0;
|
||||
e.heroic_wisdom = row[29] ? static_cast<int32_t>(atoi(row[29])) : 0;
|
||||
e.heroic_charisma = row[30] ? static_cast<int32_t>(atoi(row[30])) : 0;
|
||||
e.heroic_magic_resist = row[31] ? static_cast<int32_t>(atoi(row[31])) : 0;
|
||||
e.heroic_fire_resist = row[32] ? static_cast<int32_t>(atoi(row[32])) : 0;
|
||||
e.heroic_cold_resist = row[33] ? static_cast<int32_t>(atoi(row[33])) : 0;
|
||||
e.heroic_poison_resist = row[34] ? static_cast<int32_t>(atoi(row[34])) : 0;
|
||||
e.heroic_disease_resist = row[35] ? static_cast<int32_t>(atoi(row[35])) : 0;
|
||||
e.heroic_corruption_resist = row[36] ? static_cast<int32_t>(atoi(row[36])) : 0;
|
||||
e.haste = row[37] ? static_cast<int32_t>(atoi(row[37])) : 0;
|
||||
e.accuracy = row[38] ? static_cast<int32_t>(atoi(row[38])) : 0;
|
||||
e.attack = row[39] ? static_cast<int32_t>(atoi(row[39])) : 0;
|
||||
e.avoidance = row[40] ? static_cast<int32_t>(atoi(row[40])) : 0;
|
||||
e.clairvoyance = row[41] ? static_cast<int32_t>(atoi(row[41])) : 0;
|
||||
e.combat_effects = row[42] ? static_cast<int32_t>(atoi(row[42])) : 0;
|
||||
e.damage_shield_mitigation = row[43] ? static_cast<int32_t>(atoi(row[43])) : 0;
|
||||
e.damage_shield = row[44] ? static_cast<int32_t>(atoi(row[44])) : 0;
|
||||
e.dot_shielding = row[45] ? static_cast<int32_t>(atoi(row[45])) : 0;
|
||||
e.hp_regen = row[46] ? static_cast<int32_t>(atoi(row[46])) : 0;
|
||||
e.mana_regen = row[47] ? static_cast<int32_t>(atoi(row[47])) : 0;
|
||||
e.endurance_regen = row[48] ? static_cast<int32_t>(atoi(row[48])) : 0;
|
||||
e.shielding = row[49] ? static_cast<int32_t>(atoi(row[49])) : 0;
|
||||
e.spell_damage = row[50] ? static_cast<int32_t>(atoi(row[50])) : 0;
|
||||
e.spell_shielding = row[51] ? static_cast<int32_t>(atoi(row[51])) : 0;
|
||||
e.strikethrough = row[52] ? static_cast<int32_t>(atoi(row[52])) : 0;
|
||||
e.stun_resist = row[53] ? static_cast<int32_t>(atoi(row[53])) : 0;
|
||||
e.backstab = row[54] ? static_cast<int32_t>(atoi(row[54])) : 0;
|
||||
e.wind = row[55] ? static_cast<int32_t>(atoi(row[55])) : 0;
|
||||
e.brass = row[56] ? static_cast<int32_t>(atoi(row[56])) : 0;
|
||||
e.string = row[57] ? static_cast<int32_t>(atoi(row[57])) : 0;
|
||||
e.percussion = row[58] ? static_cast<int32_t>(atoi(row[58])) : 0;
|
||||
e.singing = row[59] ? static_cast<int32_t>(atoi(row[59])) : 0;
|
||||
e.baking = row[60] ? static_cast<int32_t>(atoi(row[60])) : 0;
|
||||
e.alchemy = row[61] ? static_cast<int32_t>(atoi(row[61])) : 0;
|
||||
e.tailoring = row[62] ? static_cast<int32_t>(atoi(row[62])) : 0;
|
||||
e.blacksmithing = row[63] ? static_cast<int32_t>(atoi(row[63])) : 0;
|
||||
e.fletching = row[64] ? static_cast<int32_t>(atoi(row[64])) : 0;
|
||||
e.brewing = row[65] ? static_cast<int32_t>(atoi(row[65])) : 0;
|
||||
e.jewelry = row[66] ? static_cast<int32_t>(atoi(row[66])) : 0;
|
||||
e.pottery = row[67] ? static_cast<int32_t>(atoi(row[67])) : 0;
|
||||
e.research = row[68] ? static_cast<int32_t>(atoi(row[68])) : 0;
|
||||
e.alcohol = row[69] ? static_cast<int32_t>(atoi(row[69])) : 0;
|
||||
e.fishing = row[70] ? static_cast<int32_t>(atoi(row[70])) : 0;
|
||||
e.tinkering = row[71] ? static_cast<int32_t>(atoi(row[71])) : 0;
|
||||
e.created_at = strtoll(row[72] ? row[72] : "-1", nullptr, 10);
|
||||
e.updated_at = strtoll(row[73] ? row[73] : "-1", nullptr, 10);
|
||||
|
||||
@@ -820,78 +819,78 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterStatsRecord e{};
|
||||
|
||||
e.character_id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.character_id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.status = static_cast<int32_t>(atoi(row[2]));
|
||||
e.level = static_cast<int32_t>(atoi(row[3]));
|
||||
e.class_ = static_cast<int32_t>(atoi(row[4]));
|
||||
e.race = static_cast<int32_t>(atoi(row[5]));
|
||||
e.aa_points = static_cast<int32_t>(atoi(row[6]));
|
||||
e.hp = strtoll(row[7], nullptr, 10);
|
||||
e.mana = strtoll(row[8], nullptr, 10);
|
||||
e.endurance = strtoll(row[9], nullptr, 10);
|
||||
e.ac = static_cast<int32_t>(atoi(row[10]));
|
||||
e.strength = static_cast<int32_t>(atoi(row[11]));
|
||||
e.stamina = static_cast<int32_t>(atoi(row[12]));
|
||||
e.dexterity = static_cast<int32_t>(atoi(row[13]));
|
||||
e.agility = static_cast<int32_t>(atoi(row[14]));
|
||||
e.intelligence = static_cast<int32_t>(atoi(row[15]));
|
||||
e.wisdom = static_cast<int32_t>(atoi(row[16]));
|
||||
e.charisma = static_cast<int32_t>(atoi(row[17]));
|
||||
e.magic_resist = static_cast<int32_t>(atoi(row[18]));
|
||||
e.fire_resist = static_cast<int32_t>(atoi(row[19]));
|
||||
e.cold_resist = static_cast<int32_t>(atoi(row[20]));
|
||||
e.poison_resist = static_cast<int32_t>(atoi(row[21]));
|
||||
e.disease_resist = static_cast<int32_t>(atoi(row[22]));
|
||||
e.corruption_resist = static_cast<int32_t>(atoi(row[23]));
|
||||
e.heroic_strength = static_cast<int32_t>(atoi(row[24]));
|
||||
e.heroic_stamina = static_cast<int32_t>(atoi(row[25]));
|
||||
e.heroic_dexterity = static_cast<int32_t>(atoi(row[26]));
|
||||
e.heroic_agility = static_cast<int32_t>(atoi(row[27]));
|
||||
e.heroic_intelligence = static_cast<int32_t>(atoi(row[28]));
|
||||
e.heroic_wisdom = static_cast<int32_t>(atoi(row[29]));
|
||||
e.heroic_charisma = static_cast<int32_t>(atoi(row[30]));
|
||||
e.heroic_magic_resist = static_cast<int32_t>(atoi(row[31]));
|
||||
e.heroic_fire_resist = static_cast<int32_t>(atoi(row[32]));
|
||||
e.heroic_cold_resist = static_cast<int32_t>(atoi(row[33]));
|
||||
e.heroic_poison_resist = static_cast<int32_t>(atoi(row[34]));
|
||||
e.heroic_disease_resist = static_cast<int32_t>(atoi(row[35]));
|
||||
e.heroic_corruption_resist = static_cast<int32_t>(atoi(row[36]));
|
||||
e.haste = static_cast<int32_t>(atoi(row[37]));
|
||||
e.accuracy = static_cast<int32_t>(atoi(row[38]));
|
||||
e.attack = static_cast<int32_t>(atoi(row[39]));
|
||||
e.avoidance = static_cast<int32_t>(atoi(row[40]));
|
||||
e.clairvoyance = static_cast<int32_t>(atoi(row[41]));
|
||||
e.combat_effects = static_cast<int32_t>(atoi(row[42]));
|
||||
e.damage_shield_mitigation = static_cast<int32_t>(atoi(row[43]));
|
||||
e.damage_shield = static_cast<int32_t>(atoi(row[44]));
|
||||
e.dot_shielding = static_cast<int32_t>(atoi(row[45]));
|
||||
e.hp_regen = static_cast<int32_t>(atoi(row[46]));
|
||||
e.mana_regen = static_cast<int32_t>(atoi(row[47]));
|
||||
e.endurance_regen = static_cast<int32_t>(atoi(row[48]));
|
||||
e.shielding = static_cast<int32_t>(atoi(row[49]));
|
||||
e.spell_damage = static_cast<int32_t>(atoi(row[50]));
|
||||
e.spell_shielding = static_cast<int32_t>(atoi(row[51]));
|
||||
e.strikethrough = static_cast<int32_t>(atoi(row[52]));
|
||||
e.stun_resist = static_cast<int32_t>(atoi(row[53]));
|
||||
e.backstab = static_cast<int32_t>(atoi(row[54]));
|
||||
e.wind = static_cast<int32_t>(atoi(row[55]));
|
||||
e.brass = static_cast<int32_t>(atoi(row[56]));
|
||||
e.string = static_cast<int32_t>(atoi(row[57]));
|
||||
e.percussion = static_cast<int32_t>(atoi(row[58]));
|
||||
e.singing = static_cast<int32_t>(atoi(row[59]));
|
||||
e.baking = static_cast<int32_t>(atoi(row[60]));
|
||||
e.alchemy = static_cast<int32_t>(atoi(row[61]));
|
||||
e.tailoring = static_cast<int32_t>(atoi(row[62]));
|
||||
e.blacksmithing = static_cast<int32_t>(atoi(row[63]));
|
||||
e.fletching = static_cast<int32_t>(atoi(row[64]));
|
||||
e.brewing = static_cast<int32_t>(atoi(row[65]));
|
||||
e.jewelry = static_cast<int32_t>(atoi(row[66]));
|
||||
e.pottery = static_cast<int32_t>(atoi(row[67]));
|
||||
e.research = static_cast<int32_t>(atoi(row[68]));
|
||||
e.alcohol = static_cast<int32_t>(atoi(row[69]));
|
||||
e.fishing = static_cast<int32_t>(atoi(row[70]));
|
||||
e.tinkering = static_cast<int32_t>(atoi(row[71]));
|
||||
e.status = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
e.level = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
e.class_ = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||
e.race = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
|
||||
e.aa_points = row[6] ? static_cast<int32_t>(atoi(row[6])) : 0;
|
||||
e.hp = row[7] ? strtoll(row[7], nullptr, 10) : 0;
|
||||
e.mana = row[8] ? strtoll(row[8], nullptr, 10) : 0;
|
||||
e.endurance = row[9] ? strtoll(row[9], nullptr, 10) : 0;
|
||||
e.ac = row[10] ? static_cast<int32_t>(atoi(row[10])) : 0;
|
||||
e.strength = row[11] ? static_cast<int32_t>(atoi(row[11])) : 0;
|
||||
e.stamina = row[12] ? static_cast<int32_t>(atoi(row[12])) : 0;
|
||||
e.dexterity = row[13] ? static_cast<int32_t>(atoi(row[13])) : 0;
|
||||
e.agility = row[14] ? static_cast<int32_t>(atoi(row[14])) : 0;
|
||||
e.intelligence = row[15] ? static_cast<int32_t>(atoi(row[15])) : 0;
|
||||
e.wisdom = row[16] ? static_cast<int32_t>(atoi(row[16])) : 0;
|
||||
e.charisma = row[17] ? static_cast<int32_t>(atoi(row[17])) : 0;
|
||||
e.magic_resist = row[18] ? static_cast<int32_t>(atoi(row[18])) : 0;
|
||||
e.fire_resist = row[19] ? static_cast<int32_t>(atoi(row[19])) : 0;
|
||||
e.cold_resist = row[20] ? static_cast<int32_t>(atoi(row[20])) : 0;
|
||||
e.poison_resist = row[21] ? static_cast<int32_t>(atoi(row[21])) : 0;
|
||||
e.disease_resist = row[22] ? static_cast<int32_t>(atoi(row[22])) : 0;
|
||||
e.corruption_resist = row[23] ? static_cast<int32_t>(atoi(row[23])) : 0;
|
||||
e.heroic_strength = row[24] ? static_cast<int32_t>(atoi(row[24])) : 0;
|
||||
e.heroic_stamina = row[25] ? static_cast<int32_t>(atoi(row[25])) : 0;
|
||||
e.heroic_dexterity = row[26] ? static_cast<int32_t>(atoi(row[26])) : 0;
|
||||
e.heroic_agility = row[27] ? static_cast<int32_t>(atoi(row[27])) : 0;
|
||||
e.heroic_intelligence = row[28] ? static_cast<int32_t>(atoi(row[28])) : 0;
|
||||
e.heroic_wisdom = row[29] ? static_cast<int32_t>(atoi(row[29])) : 0;
|
||||
e.heroic_charisma = row[30] ? static_cast<int32_t>(atoi(row[30])) : 0;
|
||||
e.heroic_magic_resist = row[31] ? static_cast<int32_t>(atoi(row[31])) : 0;
|
||||
e.heroic_fire_resist = row[32] ? static_cast<int32_t>(atoi(row[32])) : 0;
|
||||
e.heroic_cold_resist = row[33] ? static_cast<int32_t>(atoi(row[33])) : 0;
|
||||
e.heroic_poison_resist = row[34] ? static_cast<int32_t>(atoi(row[34])) : 0;
|
||||
e.heroic_disease_resist = row[35] ? static_cast<int32_t>(atoi(row[35])) : 0;
|
||||
e.heroic_corruption_resist = row[36] ? static_cast<int32_t>(atoi(row[36])) : 0;
|
||||
e.haste = row[37] ? static_cast<int32_t>(atoi(row[37])) : 0;
|
||||
e.accuracy = row[38] ? static_cast<int32_t>(atoi(row[38])) : 0;
|
||||
e.attack = row[39] ? static_cast<int32_t>(atoi(row[39])) : 0;
|
||||
e.avoidance = row[40] ? static_cast<int32_t>(atoi(row[40])) : 0;
|
||||
e.clairvoyance = row[41] ? static_cast<int32_t>(atoi(row[41])) : 0;
|
||||
e.combat_effects = row[42] ? static_cast<int32_t>(atoi(row[42])) : 0;
|
||||
e.damage_shield_mitigation = row[43] ? static_cast<int32_t>(atoi(row[43])) : 0;
|
||||
e.damage_shield = row[44] ? static_cast<int32_t>(atoi(row[44])) : 0;
|
||||
e.dot_shielding = row[45] ? static_cast<int32_t>(atoi(row[45])) : 0;
|
||||
e.hp_regen = row[46] ? static_cast<int32_t>(atoi(row[46])) : 0;
|
||||
e.mana_regen = row[47] ? static_cast<int32_t>(atoi(row[47])) : 0;
|
||||
e.endurance_regen = row[48] ? static_cast<int32_t>(atoi(row[48])) : 0;
|
||||
e.shielding = row[49] ? static_cast<int32_t>(atoi(row[49])) : 0;
|
||||
e.spell_damage = row[50] ? static_cast<int32_t>(atoi(row[50])) : 0;
|
||||
e.spell_shielding = row[51] ? static_cast<int32_t>(atoi(row[51])) : 0;
|
||||
e.strikethrough = row[52] ? static_cast<int32_t>(atoi(row[52])) : 0;
|
||||
e.stun_resist = row[53] ? static_cast<int32_t>(atoi(row[53])) : 0;
|
||||
e.backstab = row[54] ? static_cast<int32_t>(atoi(row[54])) : 0;
|
||||
e.wind = row[55] ? static_cast<int32_t>(atoi(row[55])) : 0;
|
||||
e.brass = row[56] ? static_cast<int32_t>(atoi(row[56])) : 0;
|
||||
e.string = row[57] ? static_cast<int32_t>(atoi(row[57])) : 0;
|
||||
e.percussion = row[58] ? static_cast<int32_t>(atoi(row[58])) : 0;
|
||||
e.singing = row[59] ? static_cast<int32_t>(atoi(row[59])) : 0;
|
||||
e.baking = row[60] ? static_cast<int32_t>(atoi(row[60])) : 0;
|
||||
e.alchemy = row[61] ? static_cast<int32_t>(atoi(row[61])) : 0;
|
||||
e.tailoring = row[62] ? static_cast<int32_t>(atoi(row[62])) : 0;
|
||||
e.blacksmithing = row[63] ? static_cast<int32_t>(atoi(row[63])) : 0;
|
||||
e.fletching = row[64] ? static_cast<int32_t>(atoi(row[64])) : 0;
|
||||
e.brewing = row[65] ? static_cast<int32_t>(atoi(row[65])) : 0;
|
||||
e.jewelry = row[66] ? static_cast<int32_t>(atoi(row[66])) : 0;
|
||||
e.pottery = row[67] ? static_cast<int32_t>(atoi(row[67])) : 0;
|
||||
e.research = row[68] ? static_cast<int32_t>(atoi(row[68])) : 0;
|
||||
e.alcohol = row[69] ? static_cast<int32_t>(atoi(row[69])) : 0;
|
||||
e.fishing = row[70] ? static_cast<int32_t>(atoi(row[70])) : 0;
|
||||
e.tinkering = row[71] ? static_cast<int32_t>(atoi(row[71])) : 0;
|
||||
e.created_at = strtoll(row[72] ? row[72] : "-1", nullptr, 10);
|
||||
e.updated_at = strtoll(row[73] ? row[73] : "-1", nullptr, 10);
|
||||
|
||||
@@ -918,78 +917,78 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterStatsRecord e{};
|
||||
|
||||
e.character_id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.character_id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.status = static_cast<int32_t>(atoi(row[2]));
|
||||
e.level = static_cast<int32_t>(atoi(row[3]));
|
||||
e.class_ = static_cast<int32_t>(atoi(row[4]));
|
||||
e.race = static_cast<int32_t>(atoi(row[5]));
|
||||
e.aa_points = static_cast<int32_t>(atoi(row[6]));
|
||||
e.hp = strtoll(row[7], nullptr, 10);
|
||||
e.mana = strtoll(row[8], nullptr, 10);
|
||||
e.endurance = strtoll(row[9], nullptr, 10);
|
||||
e.ac = static_cast<int32_t>(atoi(row[10]));
|
||||
e.strength = static_cast<int32_t>(atoi(row[11]));
|
||||
e.stamina = static_cast<int32_t>(atoi(row[12]));
|
||||
e.dexterity = static_cast<int32_t>(atoi(row[13]));
|
||||
e.agility = static_cast<int32_t>(atoi(row[14]));
|
||||
e.intelligence = static_cast<int32_t>(atoi(row[15]));
|
||||
e.wisdom = static_cast<int32_t>(atoi(row[16]));
|
||||
e.charisma = static_cast<int32_t>(atoi(row[17]));
|
||||
e.magic_resist = static_cast<int32_t>(atoi(row[18]));
|
||||
e.fire_resist = static_cast<int32_t>(atoi(row[19]));
|
||||
e.cold_resist = static_cast<int32_t>(atoi(row[20]));
|
||||
e.poison_resist = static_cast<int32_t>(atoi(row[21]));
|
||||
e.disease_resist = static_cast<int32_t>(atoi(row[22]));
|
||||
e.corruption_resist = static_cast<int32_t>(atoi(row[23]));
|
||||
e.heroic_strength = static_cast<int32_t>(atoi(row[24]));
|
||||
e.heroic_stamina = static_cast<int32_t>(atoi(row[25]));
|
||||
e.heroic_dexterity = static_cast<int32_t>(atoi(row[26]));
|
||||
e.heroic_agility = static_cast<int32_t>(atoi(row[27]));
|
||||
e.heroic_intelligence = static_cast<int32_t>(atoi(row[28]));
|
||||
e.heroic_wisdom = static_cast<int32_t>(atoi(row[29]));
|
||||
e.heroic_charisma = static_cast<int32_t>(atoi(row[30]));
|
||||
e.heroic_magic_resist = static_cast<int32_t>(atoi(row[31]));
|
||||
e.heroic_fire_resist = static_cast<int32_t>(atoi(row[32]));
|
||||
e.heroic_cold_resist = static_cast<int32_t>(atoi(row[33]));
|
||||
e.heroic_poison_resist = static_cast<int32_t>(atoi(row[34]));
|
||||
e.heroic_disease_resist = static_cast<int32_t>(atoi(row[35]));
|
||||
e.heroic_corruption_resist = static_cast<int32_t>(atoi(row[36]));
|
||||
e.haste = static_cast<int32_t>(atoi(row[37]));
|
||||
e.accuracy = static_cast<int32_t>(atoi(row[38]));
|
||||
e.attack = static_cast<int32_t>(atoi(row[39]));
|
||||
e.avoidance = static_cast<int32_t>(atoi(row[40]));
|
||||
e.clairvoyance = static_cast<int32_t>(atoi(row[41]));
|
||||
e.combat_effects = static_cast<int32_t>(atoi(row[42]));
|
||||
e.damage_shield_mitigation = static_cast<int32_t>(atoi(row[43]));
|
||||
e.damage_shield = static_cast<int32_t>(atoi(row[44]));
|
||||
e.dot_shielding = static_cast<int32_t>(atoi(row[45]));
|
||||
e.hp_regen = static_cast<int32_t>(atoi(row[46]));
|
||||
e.mana_regen = static_cast<int32_t>(atoi(row[47]));
|
||||
e.endurance_regen = static_cast<int32_t>(atoi(row[48]));
|
||||
e.shielding = static_cast<int32_t>(atoi(row[49]));
|
||||
e.spell_damage = static_cast<int32_t>(atoi(row[50]));
|
||||
e.spell_shielding = static_cast<int32_t>(atoi(row[51]));
|
||||
e.strikethrough = static_cast<int32_t>(atoi(row[52]));
|
||||
e.stun_resist = static_cast<int32_t>(atoi(row[53]));
|
||||
e.backstab = static_cast<int32_t>(atoi(row[54]));
|
||||
e.wind = static_cast<int32_t>(atoi(row[55]));
|
||||
e.brass = static_cast<int32_t>(atoi(row[56]));
|
||||
e.string = static_cast<int32_t>(atoi(row[57]));
|
||||
e.percussion = static_cast<int32_t>(atoi(row[58]));
|
||||
e.singing = static_cast<int32_t>(atoi(row[59]));
|
||||
e.baking = static_cast<int32_t>(atoi(row[60]));
|
||||
e.alchemy = static_cast<int32_t>(atoi(row[61]));
|
||||
e.tailoring = static_cast<int32_t>(atoi(row[62]));
|
||||
e.blacksmithing = static_cast<int32_t>(atoi(row[63]));
|
||||
e.fletching = static_cast<int32_t>(atoi(row[64]));
|
||||
e.brewing = static_cast<int32_t>(atoi(row[65]));
|
||||
e.jewelry = static_cast<int32_t>(atoi(row[66]));
|
||||
e.pottery = static_cast<int32_t>(atoi(row[67]));
|
||||
e.research = static_cast<int32_t>(atoi(row[68]));
|
||||
e.alcohol = static_cast<int32_t>(atoi(row[69]));
|
||||
e.fishing = static_cast<int32_t>(atoi(row[70]));
|
||||
e.tinkering = static_cast<int32_t>(atoi(row[71]));
|
||||
e.status = row[2] ? static_cast<int32_t>(atoi(row[2])) : 0;
|
||||
e.level = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
e.class_ = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||
e.race = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
|
||||
e.aa_points = row[6] ? static_cast<int32_t>(atoi(row[6])) : 0;
|
||||
e.hp = row[7] ? strtoll(row[7], nullptr, 10) : 0;
|
||||
e.mana = row[8] ? strtoll(row[8], nullptr, 10) : 0;
|
||||
e.endurance = row[9] ? strtoll(row[9], nullptr, 10) : 0;
|
||||
e.ac = row[10] ? static_cast<int32_t>(atoi(row[10])) : 0;
|
||||
e.strength = row[11] ? static_cast<int32_t>(atoi(row[11])) : 0;
|
||||
e.stamina = row[12] ? static_cast<int32_t>(atoi(row[12])) : 0;
|
||||
e.dexterity = row[13] ? static_cast<int32_t>(atoi(row[13])) : 0;
|
||||
e.agility = row[14] ? static_cast<int32_t>(atoi(row[14])) : 0;
|
||||
e.intelligence = row[15] ? static_cast<int32_t>(atoi(row[15])) : 0;
|
||||
e.wisdom = row[16] ? static_cast<int32_t>(atoi(row[16])) : 0;
|
||||
e.charisma = row[17] ? static_cast<int32_t>(atoi(row[17])) : 0;
|
||||
e.magic_resist = row[18] ? static_cast<int32_t>(atoi(row[18])) : 0;
|
||||
e.fire_resist = row[19] ? static_cast<int32_t>(atoi(row[19])) : 0;
|
||||
e.cold_resist = row[20] ? static_cast<int32_t>(atoi(row[20])) : 0;
|
||||
e.poison_resist = row[21] ? static_cast<int32_t>(atoi(row[21])) : 0;
|
||||
e.disease_resist = row[22] ? static_cast<int32_t>(atoi(row[22])) : 0;
|
||||
e.corruption_resist = row[23] ? static_cast<int32_t>(atoi(row[23])) : 0;
|
||||
e.heroic_strength = row[24] ? static_cast<int32_t>(atoi(row[24])) : 0;
|
||||
e.heroic_stamina = row[25] ? static_cast<int32_t>(atoi(row[25])) : 0;
|
||||
e.heroic_dexterity = row[26] ? static_cast<int32_t>(atoi(row[26])) : 0;
|
||||
e.heroic_agility = row[27] ? static_cast<int32_t>(atoi(row[27])) : 0;
|
||||
e.heroic_intelligence = row[28] ? static_cast<int32_t>(atoi(row[28])) : 0;
|
||||
e.heroic_wisdom = row[29] ? static_cast<int32_t>(atoi(row[29])) : 0;
|
||||
e.heroic_charisma = row[30] ? static_cast<int32_t>(atoi(row[30])) : 0;
|
||||
e.heroic_magic_resist = row[31] ? static_cast<int32_t>(atoi(row[31])) : 0;
|
||||
e.heroic_fire_resist = row[32] ? static_cast<int32_t>(atoi(row[32])) : 0;
|
||||
e.heroic_cold_resist = row[33] ? static_cast<int32_t>(atoi(row[33])) : 0;
|
||||
e.heroic_poison_resist = row[34] ? static_cast<int32_t>(atoi(row[34])) : 0;
|
||||
e.heroic_disease_resist = row[35] ? static_cast<int32_t>(atoi(row[35])) : 0;
|
||||
e.heroic_corruption_resist = row[36] ? static_cast<int32_t>(atoi(row[36])) : 0;
|
||||
e.haste = row[37] ? static_cast<int32_t>(atoi(row[37])) : 0;
|
||||
e.accuracy = row[38] ? static_cast<int32_t>(atoi(row[38])) : 0;
|
||||
e.attack = row[39] ? static_cast<int32_t>(atoi(row[39])) : 0;
|
||||
e.avoidance = row[40] ? static_cast<int32_t>(atoi(row[40])) : 0;
|
||||
e.clairvoyance = row[41] ? static_cast<int32_t>(atoi(row[41])) : 0;
|
||||
e.combat_effects = row[42] ? static_cast<int32_t>(atoi(row[42])) : 0;
|
||||
e.damage_shield_mitigation = row[43] ? static_cast<int32_t>(atoi(row[43])) : 0;
|
||||
e.damage_shield = row[44] ? static_cast<int32_t>(atoi(row[44])) : 0;
|
||||
e.dot_shielding = row[45] ? static_cast<int32_t>(atoi(row[45])) : 0;
|
||||
e.hp_regen = row[46] ? static_cast<int32_t>(atoi(row[46])) : 0;
|
||||
e.mana_regen = row[47] ? static_cast<int32_t>(atoi(row[47])) : 0;
|
||||
e.endurance_regen = row[48] ? static_cast<int32_t>(atoi(row[48])) : 0;
|
||||
e.shielding = row[49] ? static_cast<int32_t>(atoi(row[49])) : 0;
|
||||
e.spell_damage = row[50] ? static_cast<int32_t>(atoi(row[50])) : 0;
|
||||
e.spell_shielding = row[51] ? static_cast<int32_t>(atoi(row[51])) : 0;
|
||||
e.strikethrough = row[52] ? static_cast<int32_t>(atoi(row[52])) : 0;
|
||||
e.stun_resist = row[53] ? static_cast<int32_t>(atoi(row[53])) : 0;
|
||||
e.backstab = row[54] ? static_cast<int32_t>(atoi(row[54])) : 0;
|
||||
e.wind = row[55] ? static_cast<int32_t>(atoi(row[55])) : 0;
|
||||
e.brass = row[56] ? static_cast<int32_t>(atoi(row[56])) : 0;
|
||||
e.string = row[57] ? static_cast<int32_t>(atoi(row[57])) : 0;
|
||||
e.percussion = row[58] ? static_cast<int32_t>(atoi(row[58])) : 0;
|
||||
e.singing = row[59] ? static_cast<int32_t>(atoi(row[59])) : 0;
|
||||
e.baking = row[60] ? static_cast<int32_t>(atoi(row[60])) : 0;
|
||||
e.alchemy = row[61] ? static_cast<int32_t>(atoi(row[61])) : 0;
|
||||
e.tailoring = row[62] ? static_cast<int32_t>(atoi(row[62])) : 0;
|
||||
e.blacksmithing = row[63] ? static_cast<int32_t>(atoi(row[63])) : 0;
|
||||
e.fletching = row[64] ? static_cast<int32_t>(atoi(row[64])) : 0;
|
||||
e.brewing = row[65] ? static_cast<int32_t>(atoi(row[65])) : 0;
|
||||
e.jewelry = row[66] ? static_cast<int32_t>(atoi(row[66])) : 0;
|
||||
e.pottery = row[67] ? static_cast<int32_t>(atoi(row[67])) : 0;
|
||||
e.research = row[68] ? static_cast<int32_t>(atoi(row[68])) : 0;
|
||||
e.alcohol = row[69] ? static_cast<int32_t>(atoi(row[69])) : 0;
|
||||
e.fishing = row[70] ? static_cast<int32_t>(atoi(row[70])) : 0;
|
||||
e.tinkering = row[71] ? static_cast<int32_t>(atoi(row[71])) : 0;
|
||||
e.created_at = strtoll(row[72] ? row[72] : "-1", nullptr, 10);
|
||||
e.updated_at = strtoll(row[73] ? row[73] : "-1", nullptr, 10);
|
||||
|
||||
@@ -1050,6 +1049,208 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterStatsRecord &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.character_id));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
v.push_back(std::to_string(e.status));
|
||||
v.push_back(std::to_string(e.level));
|
||||
v.push_back(std::to_string(e.class_));
|
||||
v.push_back(std::to_string(e.race));
|
||||
v.push_back(std::to_string(e.aa_points));
|
||||
v.push_back(std::to_string(e.hp));
|
||||
v.push_back(std::to_string(e.mana));
|
||||
v.push_back(std::to_string(e.endurance));
|
||||
v.push_back(std::to_string(e.ac));
|
||||
v.push_back(std::to_string(e.strength));
|
||||
v.push_back(std::to_string(e.stamina));
|
||||
v.push_back(std::to_string(e.dexterity));
|
||||
v.push_back(std::to_string(e.agility));
|
||||
v.push_back(std::to_string(e.intelligence));
|
||||
v.push_back(std::to_string(e.wisdom));
|
||||
v.push_back(std::to_string(e.charisma));
|
||||
v.push_back(std::to_string(e.magic_resist));
|
||||
v.push_back(std::to_string(e.fire_resist));
|
||||
v.push_back(std::to_string(e.cold_resist));
|
||||
v.push_back(std::to_string(e.poison_resist));
|
||||
v.push_back(std::to_string(e.disease_resist));
|
||||
v.push_back(std::to_string(e.corruption_resist));
|
||||
v.push_back(std::to_string(e.heroic_strength));
|
||||
v.push_back(std::to_string(e.heroic_stamina));
|
||||
v.push_back(std::to_string(e.heroic_dexterity));
|
||||
v.push_back(std::to_string(e.heroic_agility));
|
||||
v.push_back(std::to_string(e.heroic_intelligence));
|
||||
v.push_back(std::to_string(e.heroic_wisdom));
|
||||
v.push_back(std::to_string(e.heroic_charisma));
|
||||
v.push_back(std::to_string(e.heroic_magic_resist));
|
||||
v.push_back(std::to_string(e.heroic_fire_resist));
|
||||
v.push_back(std::to_string(e.heroic_cold_resist));
|
||||
v.push_back(std::to_string(e.heroic_poison_resist));
|
||||
v.push_back(std::to_string(e.heroic_disease_resist));
|
||||
v.push_back(std::to_string(e.heroic_corruption_resist));
|
||||
v.push_back(std::to_string(e.haste));
|
||||
v.push_back(std::to_string(e.accuracy));
|
||||
v.push_back(std::to_string(e.attack));
|
||||
v.push_back(std::to_string(e.avoidance));
|
||||
v.push_back(std::to_string(e.clairvoyance));
|
||||
v.push_back(std::to_string(e.combat_effects));
|
||||
v.push_back(std::to_string(e.damage_shield_mitigation));
|
||||
v.push_back(std::to_string(e.damage_shield));
|
||||
v.push_back(std::to_string(e.dot_shielding));
|
||||
v.push_back(std::to_string(e.hp_regen));
|
||||
v.push_back(std::to_string(e.mana_regen));
|
||||
v.push_back(std::to_string(e.endurance_regen));
|
||||
v.push_back(std::to_string(e.shielding));
|
||||
v.push_back(std::to_string(e.spell_damage));
|
||||
v.push_back(std::to_string(e.spell_shielding));
|
||||
v.push_back(std::to_string(e.strikethrough));
|
||||
v.push_back(std::to_string(e.stun_resist));
|
||||
v.push_back(std::to_string(e.backstab));
|
||||
v.push_back(std::to_string(e.wind));
|
||||
v.push_back(std::to_string(e.brass));
|
||||
v.push_back(std::to_string(e.string));
|
||||
v.push_back(std::to_string(e.percussion));
|
||||
v.push_back(std::to_string(e.singing));
|
||||
v.push_back(std::to_string(e.baking));
|
||||
v.push_back(std::to_string(e.alchemy));
|
||||
v.push_back(std::to_string(e.tailoring));
|
||||
v.push_back(std::to_string(e.blacksmithing));
|
||||
v.push_back(std::to_string(e.fletching));
|
||||
v.push_back(std::to_string(e.brewing));
|
||||
v.push_back(std::to_string(e.jewelry));
|
||||
v.push_back(std::to_string(e.pottery));
|
||||
v.push_back(std::to_string(e.research));
|
||||
v.push_back(std::to_string(e.alcohol));
|
||||
v.push_back(std::to_string(e.fishing));
|
||||
v.push_back(std::to_string(e.tinkering));
|
||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")");
|
||||
v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int ReplaceMany(
|
||||
Database& db,
|
||||
const std::vector<CharacterStatsRecord> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.character_id));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
v.push_back(std::to_string(e.status));
|
||||
v.push_back(std::to_string(e.level));
|
||||
v.push_back(std::to_string(e.class_));
|
||||
v.push_back(std::to_string(e.race));
|
||||
v.push_back(std::to_string(e.aa_points));
|
||||
v.push_back(std::to_string(e.hp));
|
||||
v.push_back(std::to_string(e.mana));
|
||||
v.push_back(std::to_string(e.endurance));
|
||||
v.push_back(std::to_string(e.ac));
|
||||
v.push_back(std::to_string(e.strength));
|
||||
v.push_back(std::to_string(e.stamina));
|
||||
v.push_back(std::to_string(e.dexterity));
|
||||
v.push_back(std::to_string(e.agility));
|
||||
v.push_back(std::to_string(e.intelligence));
|
||||
v.push_back(std::to_string(e.wisdom));
|
||||
v.push_back(std::to_string(e.charisma));
|
||||
v.push_back(std::to_string(e.magic_resist));
|
||||
v.push_back(std::to_string(e.fire_resist));
|
||||
v.push_back(std::to_string(e.cold_resist));
|
||||
v.push_back(std::to_string(e.poison_resist));
|
||||
v.push_back(std::to_string(e.disease_resist));
|
||||
v.push_back(std::to_string(e.corruption_resist));
|
||||
v.push_back(std::to_string(e.heroic_strength));
|
||||
v.push_back(std::to_string(e.heroic_stamina));
|
||||
v.push_back(std::to_string(e.heroic_dexterity));
|
||||
v.push_back(std::to_string(e.heroic_agility));
|
||||
v.push_back(std::to_string(e.heroic_intelligence));
|
||||
v.push_back(std::to_string(e.heroic_wisdom));
|
||||
v.push_back(std::to_string(e.heroic_charisma));
|
||||
v.push_back(std::to_string(e.heroic_magic_resist));
|
||||
v.push_back(std::to_string(e.heroic_fire_resist));
|
||||
v.push_back(std::to_string(e.heroic_cold_resist));
|
||||
v.push_back(std::to_string(e.heroic_poison_resist));
|
||||
v.push_back(std::to_string(e.heroic_disease_resist));
|
||||
v.push_back(std::to_string(e.heroic_corruption_resist));
|
||||
v.push_back(std::to_string(e.haste));
|
||||
v.push_back(std::to_string(e.accuracy));
|
||||
v.push_back(std::to_string(e.attack));
|
||||
v.push_back(std::to_string(e.avoidance));
|
||||
v.push_back(std::to_string(e.clairvoyance));
|
||||
v.push_back(std::to_string(e.combat_effects));
|
||||
v.push_back(std::to_string(e.damage_shield_mitigation));
|
||||
v.push_back(std::to_string(e.damage_shield));
|
||||
v.push_back(std::to_string(e.dot_shielding));
|
||||
v.push_back(std::to_string(e.hp_regen));
|
||||
v.push_back(std::to_string(e.mana_regen));
|
||||
v.push_back(std::to_string(e.endurance_regen));
|
||||
v.push_back(std::to_string(e.shielding));
|
||||
v.push_back(std::to_string(e.spell_damage));
|
||||
v.push_back(std::to_string(e.spell_shielding));
|
||||
v.push_back(std::to_string(e.strikethrough));
|
||||
v.push_back(std::to_string(e.stun_resist));
|
||||
v.push_back(std::to_string(e.backstab));
|
||||
v.push_back(std::to_string(e.wind));
|
||||
v.push_back(std::to_string(e.brass));
|
||||
v.push_back(std::to_string(e.string));
|
||||
v.push_back(std::to_string(e.percussion));
|
||||
v.push_back(std::to_string(e.singing));
|
||||
v.push_back(std::to_string(e.baking));
|
||||
v.push_back(std::to_string(e.alchemy));
|
||||
v.push_back(std::to_string(e.tailoring));
|
||||
v.push_back(std::to_string(e.blacksmithing));
|
||||
v.push_back(std::to_string(e.fletching));
|
||||
v.push_back(std::to_string(e.brewing));
|
||||
v.push_back(std::to_string(e.jewelry));
|
||||
v.push_back(std::to_string(e.pottery));
|
||||
v.push_back(std::to_string(e.research));
|
||||
v.push_back(std::to_string(e.alcohol));
|
||||
v.push_back(std::to_string(e.fishing));
|
||||
v.push_back(std::to_string(e.tinkering));
|
||||
v.push_back("FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")");
|
||||
v.push_back("FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")");
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_STATS_RECORD_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_TASK_TIMERS_REPOSITORY_H
|
||||
@@ -124,8 +124,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_task_timers_id
|
||||
)
|
||||
);
|
||||
@@ -134,11 +135,11 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterTaskTimers e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.character_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.task_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.timer_type = static_cast<int32_t>(atoi(row[3]));
|
||||
e.timer_group = static_cast<int32_t>(atoi(row[4]));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.character_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.task_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.timer_type = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
e.timer_group = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||
e.expire_time = strtoll(row[5] ? row[5] : "-1", nullptr, 10);
|
||||
|
||||
return e;
|
||||
@@ -273,11 +274,11 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterTaskTimers e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.character_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.task_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.timer_type = static_cast<int32_t>(atoi(row[3]));
|
||||
e.timer_group = static_cast<int32_t>(atoi(row[4]));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.character_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.task_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.timer_type = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
e.timer_group = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||
e.expire_time = strtoll(row[5] ? row[5] : "-1", nullptr, 10);
|
||||
|
||||
all_entries.push_back(e);
|
||||
@@ -303,11 +304,11 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterTaskTimers e{};
|
||||
|
||||
e.id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.character_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.task_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.timer_type = static_cast<int32_t>(atoi(row[3]));
|
||||
e.timer_group = static_cast<int32_t>(atoi(row[4]));
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.character_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.task_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.timer_type = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
|
||||
e.timer_group = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
|
||||
e.expire_time = strtoll(row[5] ? row[5] : "-1", nullptr, 10);
|
||||
|
||||
all_entries.push_back(e);
|
||||
@@ -367,6 +368,72 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterTaskTimers &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.character_id));
|
||||
v.push_back(std::to_string(e.task_id));
|
||||
v.push_back(std::to_string(e.timer_type));
|
||||
v.push_back(std::to_string(e.timer_group));
|
||||
v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int ReplaceMany(
|
||||
Database& db,
|
||||
const std::vector<CharacterTaskTimers> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.character_id));
|
||||
v.push_back(std::to_string(e.task_id));
|
||||
v.push_back(std::to_string(e.timer_type));
|
||||
v.push_back(std::to_string(e.timer_group));
|
||||
v.push_back("FROM_UNIXTIME(" + (e.expire_time > 0 ? std::to_string(e.expire_time) : "null") + ")");
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_TASK_TIMERS_REPOSITORY_H
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* Any modifications to base repositories are to be made by the generator only
|
||||
*
|
||||
* @generator ./utils/scripts/generators/repository-generator.pl
|
||||
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
* @docs https://docs.eqemu.io/developer/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHARACTER_TASKS_REPOSITORY_H
|
||||
@@ -124,8 +124,9 @@ public:
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE id = {} LIMIT 1",
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
character_tasks_id
|
||||
)
|
||||
);
|
||||
@@ -134,12 +135,12 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterTasks e{};
|
||||
|
||||
e.charid = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.taskid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.slot = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.type = static_cast<int8_t>(atoi(row[3]));
|
||||
e.acceptedtime = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.was_rewarded = static_cast<int8_t>(atoi(row[5]));
|
||||
e.charid = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.taskid = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.slot = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.type = row[3] ? static_cast<int8_t>(atoi(row[3])) : 0;
|
||||
e.acceptedtime = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.was_rewarded = row[5] ? static_cast<int8_t>(atoi(row[5])) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@@ -274,12 +275,12 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterTasks e{};
|
||||
|
||||
e.charid = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.taskid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.slot = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.type = static_cast<int8_t>(atoi(row[3]));
|
||||
e.acceptedtime = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.was_rewarded = static_cast<int8_t>(atoi(row[5]));
|
||||
e.charid = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.taskid = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.slot = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.type = row[3] ? static_cast<int8_t>(atoi(row[3])) : 0;
|
||||
e.acceptedtime = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.was_rewarded = row[5] ? static_cast<int8_t>(atoi(row[5])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -304,12 +305,12 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterTasks e{};
|
||||
|
||||
e.charid = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.taskid = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.slot = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.type = static_cast<int8_t>(atoi(row[3]));
|
||||
e.acceptedtime = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.was_rewarded = static_cast<int8_t>(atoi(row[5]));
|
||||
e.charid = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.taskid = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.slot = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.type = row[3] ? static_cast<int8_t>(atoi(row[3])) : 0;
|
||||
e.acceptedtime = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.was_rewarded = row[5] ? static_cast<int8_t>(atoi(row[5])) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@@ -368,6 +369,72 @@ public:
|
||||
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
|
||||
}
|
||||
|
||||
static std::string BaseReplace()
|
||||
{
|
||||
return fmt::format(
|
||||
"REPLACE INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static int ReplaceOne(
|
||||
Database& db,
|
||||
const CharacterTasks &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.charid));
|
||||
v.push_back(std::to_string(e.taskid));
|
||||
v.push_back(std::to_string(e.slot));
|
||||
v.push_back(std::to_string(e.type));
|
||||
v.push_back(std::to_string(e.acceptedtime));
|
||||
v.push_back(std::to_string(e.was_rewarded));
|
||||
|
||||
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<CharacterTasks> &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.taskid));
|
||||
v.push_back(std::to_string(e.slot));
|
||||
v.push_back(std::to_string(e.type));
|
||||
v.push_back(std::to_string(e.acceptedtime));
|
||||
v.push_back(std::to_string(e.was_rewarded));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES {}",
|
||||
BaseReplace(),
|
||||
Strings::Implode(",", insert_chunks)
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHARACTER_TASKS_REPOSITORY_H
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user