Compare commits

...

81 Commits

Author SHA1 Message Date
Xackery f37e0c3214 Added catch2 zone tests 2022-09-02 10:51:27 -07:00
Xackery 01b498f9c2 Fixed line printing to be hyperlink friendly 2022-09-02 10:50:02 -07:00
Xackery e0f9d9a8db Added sanity fixes for testing 2022-09-02 10:49:18 -07:00
Paul Coene ee54a7eb5f [Bug Fix] Restore missing messages for lifetap and dmg spells. (#2057)
* [Bug Fix] Restore missing messages for lifetap and dmg spells.

* Fix unintended duplicate message for DD on clients.

* Improve performance and accuracy of IsDamageSpell()
2022-04-13 23:11:26 -04:00
Kinglykrab a6814d46de [Commands] Cleanup #task Command. (#2071)
* [Commands] Cleanup #task Command.
- Cleanup messages.
- Add #task uncomplete [Task ID] to uncomplete a completed task without having to go in the database manually.

* Message cleanup.
2022-04-13 23:11:20 -04:00
KayenEQ 9dba6a6680 [Bug Fix] Blocked spells max spell id increased (#2073)
Blocked spell id should be checking int32 not int16
2022-04-13 11:54:11 -04:00
KayenEQ bc875ae554 [API] Methods for getting more information on quest timers. (#2060)
* hastimer

* [API] Check quest timer duration, timer remaining and if timer exists.

* [API] Methods for getting more information on quest timers.

* [API] Methods for getting more information on quest timers.

* [API] Methods for getting more information on quest timers.
2022-04-13 11:20:03 -04:00
KayenEQ bb897b755f [Bug Fix] Instrument Mods should not affect spells that change model size. (#2072)
Instrument Mods should not affect spells that change model size.
2022-04-13 11:02:21 -04:00
Kinglykrab a39a825045 [Quest API] Add GetBotListByCharacterID() to Perl/Lua. (#2069) 2022-04-02 17:51:26 -04:00
Paul Coene ccd0713b33 [Bug Fix] Fix recipient sound (vtell) on non-player races (#2066)
* [Bug Fix] Fix recipient sound (vtell) on non-player races

* Fix to use BaseRace as intended
2022-04-02 11:18:10 -04:00
Kinglykrab 5d94c9844a [Bug Fix] Clear title/suffix bug fix. (#2068)
- Clearing uses title ID 0, so need to make sure title ID is valid when setting and based on that, either check and set, or just clear.
2022-04-02 11:09:48 -04:00
KayenEQ bbe2db7c0f [Bug Fix] Bard Invisible causing display issues. (#2067)
* [Bug Fix] Bard Invisible causing display issues.

Error occurring due to bard modifiers being applied to invisible spell effect value.

* [Bug Fix] Bard Invisible causing display issues.
2022-04-02 00:01:38 +02:00
Kinglykrab 5dc76e595b [Quest API] Add GetBotListByClientName(client_name) to Perl/Lua. (#2064)
* [Quest API] Add GetBotListByClientName(client_name) to Perl/Lua.
- Add $entity_list->GetBotListByClientName(client_name) to Perl.
- Add eq.get_entity_list():GetBotListByClientName(client_name) to Lua.
- Allows you to get a bot list comprised solely of a specific character's bots.

* Update lua_entity_list.cpp
2022-03-23 08:47:47 -04:00
Natedog2012 b6b662f1c7 [Bug Fix] #peqzone no longer bypass Handle_OP_ZoneChange (#2063)
* [Bug Fix] #peqzone no longer bypass Handle_OP_ZoneChange

* Force other quest functions to trigger EVENT_ZONE properly

* call MovePC

* Use MoveZone to keep things uniform
2022-03-19 19:25:14 -04:00
Paul Coene 5275201713 [Bug Fix] Fix for being able to skill up on corspe. (#2058)
* [Bug Fix] Fix for being able to skill up on corspe.

* Fix whitespace
2022-03-19 13:21:54 -05:00
Paul Coene 1e86e0c02f [Bug Fix] manifest for db version 9176 had incorrect field name(#2062)
Field name in version 9176 doesn't match field created.
2022-03-19 13:13:56 -05:00
Natedog2012 25c0416f1e [Bug Fix] Force NPCs to respect special ability 24 and 50 when set on player pets (#2059)
* Force NPCs to respect special ability 24 and 50 when set on player pets

* Fix error in logic

* Remove this
2022-03-15 19:28:36 -05:00
Paul Coene 326dba6aeb [Logging] Fix log messages to final damage values (#2056) 2022-03-14 12:05:39 -04:00
Kinglykrab b75741ff4e [Bug Fix] Fix possible crash with zone name methods. (#2055)
- ZoneLongName and ZoneName were returning nullptr in places that were then attempting to use that nullptr value, causing zone crashes.
2022-03-13 15:59:57 -04:00
Kinglykrab 8e62383997 [Quest API] Add AddItem() to Perl/Lua. (#2054)
- Add $client->AddItem(item_data) to Perl.
- Add client:AddItem(item_table) to Lua.
- This will allow server operators to add items without needless parameters.

Perl Example:
```pl
my %item_data = (
	"item_id" => 1200,
	"charges" => 1,
	"augment_one" => 49656,
	"augment_two" => 49656,
	"augment_three" => 49656,
	"augment_four" => 49656,
	"augment_five" => 49656,
	"augment_six" => 49656,
	"attuned" => 1,
	"slot_id" => quest::getinventoryslotid("general1")
);
$client->AddItem(\%item_data);
```
Lua Example:
```lua
local item_data = {
	item_id = 1200,
	charges = 1,
	augment_one = 49656,
	augment_two = 49656,
	augment_three = 49656,
	augment_four = 49656,
	augment_five = 49656,
	augment_six = 49656,
	attuned = true,
	slot_id = Slot.General1
};
e.self:AddItem(item_data);
```
2022-03-13 15:59:48 -04:00
KayenEQ 4296e2e39e [API] GetNPCStat default better naming (#2053) 2022-03-12 20:01:25 -05:00
Kinglykrab e5f924d1d5 [Quest API] Allow EVENT_ZONE to be parsed as non-zero to prevent zoning. (#2052)
- This will allow server operators to prevent zoning to or from a specific zone based on whatever criteria they want.
2022-03-12 16:11:27 -05:00
Kinglykrab fb2aee1827 [Quest API] Add EVENT_CAST_ON exports to EVENT_CAST and EVENT_CAST_BEGIN. (#2051)
- Export $caster_id and $caster_level to EVENT_CAST and EVENT_CAST_BEGIN in Perl.
- Export e.caster_id and e.caster_level to EVENT_CAST and EVENT_CAST_BEGIN in Lua.
2022-03-12 14:33:00 -05:00
Kinglykrab 791d8b329d [Quest API] Export killed XYZH to EVENT_DEATH_ZONE in Perl. (#2050)
- Export $killed_x, $killed_y, $killed_z, and $killed_h to EVENT_DEATH_ZONE in Perl.
- Cleanup export strings and unnecessary .c_str() calls on event exports.
2022-03-12 13:44:01 -05:00
catapultam-habeo abcf8cbce1 [Bots] Update Bot Heal & Damage methods to more closely match Clients + Bugfixes (#2045)
* - Fixed Bots Spell Damage being negative under some circumstances (heal target)
- Allow Bots to send non-melee damage reports in the same manner as Clients
- Refactor\Update Bots Spell Damage & Heal calculations to match current state of Clients.
- Allow Bots to actually utilize Spell Damage and Heal Amount stats

* Don't send packets to bots

* remove random tab

* align text lol
2022-03-11 18:28:00 -05:00
Chris Miles 3ed6663c4c [Repositories] Update repositories (#2040) 2022-03-11 18:27:36 -05:00
Chris Miles f22608a43a [Bug FIx] Saylink Collation Database Edge Case (#2039) 2022-03-11 18:27:15 -05:00
KayenEQ 0e5d578d71 [Bug Fix] #tune command various fixes (#2046)
* tune fixes

* [Bug Fix] #tune command various fixes

accuracy tune fix
2022-03-11 10:13:51 -05:00
KayenEQ 8107ed52e1 [API] GetNPCStat can now return default stat values. (#2048)
* [API] GetNPCStat return default stat values.

* [API] GetNPCStat can now return default stat values.
2022-03-11 09:10:52 -05:00
Kinglykrab d904db0e52 [Quest API] Add caster_id and caster_level export to EVENT_CAST_ON in Perl/Lua. (#2049)
- Add $caster_id and $caster_level to EVENT_CAST_ON in Perl.
- Add e.caster_id and e.caster_level to EVENT_CAST_ON in Perl.
2022-03-10 21:46:27 -05:00
Kinglykrab e6c8a38ffa [Bug Fix] Spell Buckets/Globals did not allow string-based values. (#2043) 2022-03-09 14:18:24 -05:00
KayenEQ dbe0591b09 [API] Perl functions to set invulnerable to and modify environmental damage. (#2044)
* invulnerable

* modifier

* fix

* fix

* fix

* [API] Perl functions to set invulnerable to and modify environmental damage.

* [API] Perl and Lua functions to set invulnerable to and modify environmental damage.

credit to kinglykrab for lua
2022-03-08 19:50:46 -05:00
KayenEQ 5b6f1d38be [Bug Fix] Invisible will display as dropped now on air pets when they attack. (#2042)
invisible display issue on pets
2022-03-07 16:41:43 -05:00
JJ ce85c70a07 [Database] Update 2022_01_10_checksum_verification.sql (#2041) 2022-03-07 14:30:24 -06:00
KayenEQ f814b5bec5 [Bug Fix] PR 2032 would lock client on casting fail as written (#2038) 2022-03-06 22:03:19 -06:00
Chris Miles 4e40d7eacc [Command] Fix #killallnpcs from crashing (#2037) 2022-03-06 22:03:10 -06:00
Randy Girard 31ad0da811 [Content Filtering] Updates contents flags to be checked at runtime. (#1940)
* Updates contents flags to be checked at runtime.

* Fix formatting

* Add expansion flags

* Tweaks to logic

* Logic tweaks

* Update world_content_service.cpp

* Inverse DoesPassContentFiltering logic

* Update world_content_service.cpp

* Update world_content_service.cpp

Co-authored-by: Akkadius <akkadius1@gmail.com>
2022-03-06 22:02:57 -06:00
Chris Miles 25a19a13dc [Database] Add Primary ID Keys to Tables (#2036) 2022-03-06 22:02:33 -06:00
Paul Coene 2a5ddde78a [Feature] Client Checksum Verification (Resubmit old 1678) (#1922)
* [Feature] Client Checksum Verification (Resubmit old 1678)

* Updated db version

* Add new updatechecksum to CmakeLists.txt

* Removed magic number and used constant

* Fix new command to have access to worldserver

* spacing, more venbose desc and remove unneeded check

* Cleanup, refactoring

Co-authored-by: Akkadius <akkadius1@gmail.com>
2022-03-06 20:26:29 -06:00
catapultam-habeo eca2ed0321 [Feature] EQ2-style implied targeting for spells. (#2032)
* Implemented EQ2-style implied targeting for spells.

* Fixed nullptr w\ target that has no target
2022-03-06 20:25:40 -06:00
Paul Coene afc32afb02 [AI] Spell Type (1024) InCombatBuff were spam casting (#2030) 2022-03-06 20:18:30 -06:00
catapultam-habeo 751db6fffb [Feature] Allow pets to zone with permanent (buffdurationformula 50) buffs to maintain them through zone transitions (#2035) 2022-03-06 20:17:25 -06:00
Paul Coene c4eb1f8439 [Bug Fix] Bandolier didn't recognize source weapon on cursor (#2026)
* [Bug Fix] Bandolier didn't recognize source weapon on cursor

* Add TODO comment
2022-03-06 20:15:22 -06:00
Paul Coene d6c03b54a1 [Bug Fix] Fixed several instances of incorrect comparision - & executes after == (#2025) 2022-03-06 18:42:23 -06:00
neckkola 261a9e6938 [Bots] Fix bot spawn when bot id = char_id (#1984)
* Fix for GENERIC_9_STRINGS

* Update .gitignore

* Fixed query for use case when char_id of owner equals a bot_id

* Update BotDatabase::LoadGroupedBotsByGroupID to not use a view though correct edge case where botid=charid
2022-03-06 18:41:53 -06:00
catapultam-habeo ac214f71d4 [Bots] Apply Spells:IgnoreSpellDmgLvlRestriction to bots (#2024)
* Correct bot spell damage and healing pathways to account for rule Spell:IgnoreSpellDmgLvlRestriction

* Corrected to be more consistent in regard to the 'spells[spell_id].no_heal_damage_item_mod' modifier. This modifier doesn't seem to actually exist on any content, and bots didn't use it to begin with.

This restriction is present on players - do we want it on bots also?
2022-03-06 18:40:21 -06:00
KayenEQ fd878e7b16 [Bug Fix] Missing break (#2031) 2022-03-04 18:35:59 -05:00
Michael Cook (mackal) 58cde58b45 Fix order of operations issues in worldshutdown command (#2029) 2022-03-04 12:24:13 -05:00
Kinglykrab cc2ef11158 [Bug Fix] Objects::GetTiltX() and Objects::GetTiltY() Perl Croak Typos. (#2028)
- Typo was causing GetIncline() to show three times on Spire and causing GetTiltX() and GetTiltY() not to show at all on Spire.
2022-03-03 22:06:25 -05:00
Kinglykrab 2dfb7614cc [Bug Fix] Doors::GetSize() Perl Croak Typo. (#2027)
- Typo was causing GetIncline() to show twice on Spire and causing GetSize() not to show at all on Spire.
2022-03-03 21:54:02 -05:00
KayenEQ 6dffeacc6e [Spells] Fixes for numhits type 7 counter incrementing incorrectly. (#2022)
* [Spells] Fix for numhits type 7 counter incrementing incorrectly.

* [Spells] Fixes for numhits type 7 counter incrementing incorrectly.

bot fix

* [Spells] Fixes for numhits type 7 counter incrementing incorrectly.

mercs

* [Spells] Fixes for numhits type 7 counter incrementing incorrectly.

remove old variable and related code.

* [Spells] Fixes for numhits type 7 counter incrementing incorrectly.

comments
2022-03-01 21:20:27 -05:00
Michael 2ec6dcbe24 Merge pull request #2023 from EQEmu/bug_fix/lua_argument_dispatch 2022-02-28 20:22:12 -05:00
Kinglykrab 39bc12b582 [Bug Fix] Removed Lua Event Argument Dispatch.
Fix accidentally removal of argument dispatch for EVENT_CONSIDER_CORPSE in https://github.com/EQEmu/Server/pull/2015
2022-02-28 19:59:34 -05:00
Kinglykrab 6d78f926c8 [Commands] Cleanup #worldwide command. (#2021)
- Cleanup messages and logic.
- Command usages would not display when using commands improperly, this will fix that.
2022-02-28 19:46:56 -05:00
catapultam-habeo 00af2903c3 Rule to apply Spell Dmg and Heal Amount stats as a percentage instead of flat value. (#2017)
* Apply Spell Dmg and Heal Amt stats as a percentage increase (1 SD\HA = 1% increase to spell effectiveness) instead of a flat addition.

* Corrected logic to allow for coexistence of FlatItemExtraSpellAmt rule and this.

* Adjusted rule name to be less ambiguous.
2022-02-28 15:24:16 -05:00
Kinglykrab 58fafd0f9c [Bug Fix] quest::MovePCInstance() Arguments Fix. (#2020)
- Logic made the method return an "error" when not using last parameter.
2022-02-27 16:39:45 -05:00
Kinglykrab 9f0989ee2d [Bug Fix] Spell Buckets/Globals SQL Escape. (#2019) 2022-02-26 10:17:05 -05:00
KayenEQ 14648b96c4 [Spells] SPA 79 SE_CurrentHPOnce now will check for focus, critical and partial resist checks, except for buffs. (#2018)
* [Spells] SPA 79 SE_CurrentHPOnce check for focus and related effects.

SPA 79 SE_CurrentHPOnce should have the damage checks as SPA 0 for heal/damage

* Update spell_effects.cpp

* [Spells] SPA 79 SE_CurrentHPOnce now will check for focus, critical and partial resist checks.
2022-02-24 13:47:54 -05:00
Kinglykrab bfd1cf9379 [Quest API] Add EVENT_EQUIP_ITEM_CLIENT and EVENT_UNEQUIP_ITEM_CLIENT to Perl/Lua. (#2015)
- These events allow more customization beyond forcing operators to use a script file for each and every item they want to have some sort of functionality for these events.
- Perl event exports $item_id, $item_quantity, and $slot_id.
- Lua event exports item_id, item_quantity, slot_id, and item.
2022-02-22 20:04:08 -05:00
Chris Miles 3c35e9bbc8 [GM Command] Fix Crash Issue and Validation with #zclip (#2014)
* Fix crash issue and validation with zclip

* Formatting.

Co-authored-by: Kinglykrab <89047260+Kinglykrab@users.noreply.github.com>
2022-02-21 17:02:48 -05:00
Kinglykrab d86544ff60 [Bug Fix] Alleviate some lag with crosszone/worldwide spell casting. (#2016)
- Spell casting was using SpellFinished which casts the spell, and if the spell was a group spell each member of the group would cast it on all the other members, causing a chain reaction.
- This fix utilizes ApplySpellBuff(spell_id, duration) so that it only casts the spell on the target, as with the crosszone and worldwide methods you will be affecting your target based on identifiers regardless.
- This should alleviate some of the crosszone/worldwide casting crashes on larger servers such as Lazarus.
2022-02-20 21:59:46 -05:00
KayenEQ 70eed67e08 [Bug Fix] checking casting_spell_slot before its defined is bad (#2013) 2022-02-20 15:56:17 -05:00
KayenEQ 1c0524681e [API] perl added GetNPCStat(identifier) (#2012)
* [API] perl added GetNPCStat

Returns values of the modifiers from ModifyNPCStat

* https://github.com/EQEmu/Server/pull/2012
2022-02-20 14:00:28 -05:00
KayenEQ aa9320de3c [Spells] Bard songs from item clickies should not require components (#2011) 2022-02-18 09:37:09 -05:00
KayenEQ ad28f3c3f3 [Bug Fix] Fix for castspell command (#2010)
Fix for using castspell command with parameter 0
2022-02-17 20:44:11 -05:00
Kinglykrab 71dfa9acc0 [Commands] Bug fix for #logs command. (#2008)
* [Commands] Bug fix for #logs command.

* Update logs.cpp
2022-02-17 12:01:06 -05:00
KayenEQ 56d0478ab1 [API] Fix for SetBuffDuration function to check bard slots. (#2009) 2022-02-17 12:00:42 -05:00
Kinglykrab 0d02fadb60 [Quest API] Add GetRandomMob() and GetRandomNPC() to Perl/Lua. (#2006)
- Add $entity_list->GetRandomMob(x, y, z, distance, exclude_mob) to Perl.
- Add $entity_list->GetRandomNPC(x, y, z, distance, exclude_npc) to Perl.
- Add eq.get_entity_list():GetRandomMob(x, y, z, distance, exclude_mob) to Lua.
- Add eq.get_entity_list():GetRandomNPC(x, y, z, distance, exclude_npc) to Lua.
2022-02-17 08:57:02 -05:00
cybernine186 4de5a7b86d [Bug] Fixed trade items record log (#2003)
LogPlayerHandin was not recording the item details of the trade. It should be inserting the trade details into `qs_player_handin_record_entries` but it was not running the query because of missing QueryDatabase function.
2022-02-16 21:52:14 -06:00
KayenEQ ba3c19ad0b [Spells] AE Duration effect (Rains) will now work with Target Ring and PBAE spells. (#2000)
* done

* Update beacon.cpp

* [Spells] AE Duration effect (Rains) will now work with Target Ring and PBAE spells.

Mackals suggestions implemented.
2022-02-16 10:12:13 -05:00
Kinglykrab 8ec80644ee [Commands] Cleanup #unscribespell Command. (#1998)
* [Commands] Cleanup #unscribespell Command.
- Cleanup messages and logic.
- Add Client::UnscribeSpellBySpellID(spell_id, update_client).
- Add $client->UnscribeSpellBySpellID(spell_id, update_client) to Perl.
- Add client:UnscribeSpellBySpellID(spell_id, update_client) to Lua.

* Update unscribespell.cpp
2022-02-16 06:04:01 -05:00
Kinglykrab ed7e2b2652 [Commands] Cleanup #untraindisc Command. (#1996)
- Cleanup messages and logic.
2022-02-16 06:03:51 -05:00
KayenEQ a83ad7080a fix for meloday cast bar issue (#2005) 2022-02-15 14:01:01 -05:00
KayenEQ 677d595c9d invis updates (#2004) 2022-02-15 11:39:19 -05:00
KayenEQ 615f4a5304 [API] Apply spells with custom buff durations and adjust existing spell buff durations. (#1997)
* working

* Update spell_effects.cpp

* updates

* disable_buff_overwrite

* revert

* update

* working

* update

* updates

* Update spells.cpp

* getbuffstat done

* Update perl_mob.cpp

* [API] Apply spells with custom buff durations and adjust existing spell buff durations.

* [API] Apply spells with custom buff durations and adjust existing spell buff durations.

* [API] Apply spells with custom buff durations and adjust existing spell buff durations.

* [API] Apply spells with custom buff durations and adjust existing spell buff durations.

* https://github.com/EQEmu/Server/pull/1997

Lua added, thanks kinglykrab
2022-02-15 08:58:10 -05:00
KayenEQ 5fd62d82db Update bonuses.cpp (#2002) 2022-02-15 08:57:53 -05:00
KayenEQ b938e6223c [Spells] Invisibility updates and rework (#1991)
* updates pre merge

* update

* Update spell_effects.cpp

* Update mob.h

* test

* test

* updates

* updates

* save

* update

* working solid

* animal and undead start

* progress

* updates

* rename

* set invis appearance on bonus

* remove fade buff state check

* update IsViisble check

* optimizing

* don't break bots

* debug remover

* Update ruletypes.h

* perl adds

* Update client_packet.cpp

* update

* done

* remove debugs

* Update client_packet.cpp

* update

* [Spells] Invisibility updates and rework

lua support

* [Spells] Invisibility updates and rework

lua
2022-02-15 00:18:02 -05:00
KayenEQ 51c8771bd2 bug fix (#2001) 2022-02-15 00:17:23 -05:00
Kinglykrab cc9196bd65 [Commands] Cleanup #showskills Command. (#1994)
* [Commands] Cleanup #showskills Command.
- Utilize popup over messages.
- Usage: #showskills [Start Skill ID] [All] - shows skills starting from skill ID and if "all" is specified it will show skills the player does not have normally (no max/cannot have skill).

* Update showskills.cpp

* Update command.cpp
2022-02-14 19:49:14 -05:00
Kinglykrab 6303f129af [Commands] Cleanup #setskillall Command. (#1992)
- Cleanup messages and logic.
2022-02-14 19:02:27 -05:00
KayenEQ 3f0987ba55 [Combat] /shield command "too far away message" (#1999)
* live did something that makes sense

* [Combat] /shield command "too far away message

better chat

* [Combat] /shield command "too far away message

never mind that one was red.
2022-02-14 10:44:26 -05:00
284 changed files with 28319 additions and 1701 deletions
+116
View File
@@ -0,0 +1,116 @@
{
//"testMate.cpp.test.executables": "{build,Build,BUILD,out,Out,OUT}/**/*{test,Test,TEST}*"
"testMate.cpp.test.executables": "{build,Build,BUILD,out,Out,OUT}/**/*zone{test,Test,TEST}*",
"cmake.configureSettings": {
//"EQEMU_BUILD_SERVER": "ON",
"EQEMU_BUILD_LUA": "ON"
},
"files.associations": {
"chrono": "cpp",
"functional": "cpp",
"algorithm": "cpp",
"any": "cpp",
"array": "cpp",
"atomic": "cpp",
"bit": "cpp",
"bitset": "cpp",
"cctype": "cpp",
"cfenv": "cpp",
"charconv": "cpp",
"cinttypes": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"codecvt": "cpp",
"compare": "cpp",
"complex": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"coroutine": "cpp",
"csetjmp": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"deque": "cpp",
"exception": "cpp",
"execution": "cpp",
"resumable": "cpp",
"filesystem": "cpp",
"format": "cpp",
"forward_list": "cpp",
"fstream": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"list": "cpp",
"locale": "cpp",
"map": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"mutex": "cpp",
"new": "cpp",
"numeric": "cpp",
"optional": "cpp",
"ostream": "cpp",
"queue": "cpp",
"random": "cpp",
"ratio": "cpp",
"regex": "cpp",
"scoped_allocator": "cpp",
"set": "cpp",
"shared_mutex": "cpp",
"source_location": "cpp",
"sstream": "cpp",
"stack": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"string": "cpp",
"strstream": "cpp",
"system_error": "cpp",
"thread": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"utility": "cpp",
"valarray": "cpp",
"variant": "cpp",
"vector": "cpp",
"xfacet": "cpp",
"xhash": "cpp",
"xiosbase": "cpp",
"xlocale": "cpp",
"xlocbuf": "cpp",
"xlocinfo": "cpp",
"xlocmes": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xloctime": "cpp",
"xmemory": "cpp",
"xstddef": "cpp",
"xstring": "cpp",
"xtr1common": "cpp",
"xtree": "cpp",
"xutility": "cpp",
"*.tcc": "cpp",
"string_view": "cpp",
"rope": "cpp",
"slist": "cpp",
"*.ipp": "cpp"
}
}
+2 -1
View File
@@ -127,7 +127,7 @@ OPTION(EQEMU_COMMANDS_LOGGING "Enable GM Command logs" ON)
OPTION(EQEMU_BUILD_SERVER "Build the game server." ON)
OPTION(EQEMU_BUILD_LOGIN "Build the login server." ON)
OPTION(EQEMU_BUILD_HC "Build the headless client." OFF)
OPTION(EQEMU_BUILD_TESTS "Build utility tests." OFF)
OPTION(EQEMU_BUILD_TESTS "Build zone tests." ON)
OPTION(EQEMU_BUILD_CLIENT_FILES "Build Client Import/Export Data Programs." ON)
OPTION(EQEMU_PREFER_LUA "Build with normal Lua even if LuaJIT is found." OFF)
@@ -442,6 +442,7 @@ ENDIF(EQEMU_BUILD_HC)
IF(EQEMU_BUILD_TESTS)
ADD_SUBDIRECTORY(tests)
ADD_SUBDIRECTORY(test)
ENDIF(EQEMU_BUILD_TESTS)
IF(EQEMU_BUILD_CLIENT_FILES)
+45
View File
@@ -22,6 +22,7 @@
#include "../database.h"
#include "../rulesys.h"
#include "../eqemu_logsys.h"
#include "../loottable.h"
#include "../repositories/content_flags_repository.h"
@@ -139,6 +140,50 @@ bool WorldContentService::IsContentFlagEnabled(const std::string &content_flag)
return false;
}
/**
* @param content_flag
* @return
*/
bool WorldContentService::IsContentFlagDisabled(const std::string &content_flag)
{
for (auto &f: GetContentFlags()) {
if (f.flag_name == content_flag && f.enabled == false) {
return true;
}
}
return false;
}
bool WorldContentService::DoesPassContentFiltering(const ContentFlags &f)
{
// if we're not set to (-1 All) then fail when we aren't within minimum expansion
if (f.min_expansion > Expansion::EXPANSION_ALL && current_expansion < f.min_expansion) {
return false;
}
// if we're not set to (-1 All) then fail when we aren't within max expansion
if (f.max_expansion > Expansion::EXPANSION_ALL && current_expansion > f.max_expansion) {
return false;
}
// if we don't have any enabled flag in enabled flags, we fail
for (const auto& flag: SplitString(f.content_flags)) {
if (!contains(GetContentFlagsEnabled(), flag)) {
return false;
}
}
// if we don't have any disabled flag in disabled flags, we fail
for (const auto& flag: SplitString(f.content_flags_disabled)) {
if (!contains(GetContentFlagsDisabled(), flag)) {
return false;
}
}
return true;
}
void WorldContentService::ReloadContentFlags()
{
std::vector<ContentFlagsRepository::ContentFlags> set_content_flags;
+4
View File
@@ -23,6 +23,7 @@
#include <string>
#include <vector>
#include "../loottable.h"
#include "../repositories/content_flags_repository.h"
class Database;
@@ -165,10 +166,13 @@ public:
std::vector<std::string> GetContentFlagsEnabled();
std::vector<std::string> GetContentFlagsDisabled();
bool IsContentFlagEnabled(const std::string& content_flag);
bool IsContentFlagDisabled(const std::string& content_flag);
void SetContentFlags(std::vector<ContentFlagsRepository::ContentFlags> content_flags);
void ReloadContentFlags();
WorldContentService * SetExpansionContext();
bool DoesPassContentFiltering(const ContentFlags& f);
WorldContentService * SetDatabase(Database *database);
Database *GetDatabase() const;
+13 -1
View File
@@ -997,6 +997,18 @@ bool Database::SetVariable(const std::string varname, const std::string &varvalu
return true;
}
void Database::SetAccountCRCField(uint32 account_id, std::string field_name, uint64 checksum)
{
QueryDatabase(
fmt::format(
"UPDATE `account` SET `{}` = '{}' WHERE `id` = {}",
field_name,
checksum,
account_id
)
);
}
// Get zone starting points from DB
bool Database::GetSafePoints(const char* zone_short_name, uint32 instance_version, float* safe_x, float* safe_y, float* safe_z, float* safe_heading, int16* min_status, uint8* min_level, char *flag_needed) {
@@ -2285,7 +2297,7 @@ void Database::SetIPExemption(std::string account_ip, int exemption_amount) {
auto row = results.begin();
exemption_id = atoi(row[0]);
}
query = fmt::format(
"INSERT INTO `ip_exemptions` (`exemption_ip`, `exemption_amount`) VALUES ('{}', {})",
account_ip,
+2
View File
@@ -190,6 +190,8 @@ public:
int16 CheckStatus(uint32 account_id);
void SetAccountCRCField(uint32 account_id, std::string field_name, uint64 checksum);
uint32 CheckLogin(const char* name, const char* password, const char *loginserver, int16* oStatus = 0);
uint32 CreateAccount(const char* name, const char* password, int16 status, const char* loginserver, uint32 lsaccount_id);
uint32 GetAccountIDFromLSID(const std::string& in_loginserver_id, uint32 in_loginserver_account_id, char* in_account_name = 0, int16* in_status = 0);
+1
View File
@@ -558,6 +558,7 @@ N(OP_WhoAllRequest),
N(OP_WhoAllResponse),
N(OP_World_Client_CRC1),
N(OP_World_Client_CRC2),
N(OP_World_Client_CRC3),
N(OP_WorldClientReady),
N(OP_WorldComplete),
N(OP_WorldLogout),
+5
View File
@@ -5582,6 +5582,11 @@ struct SayLinkBodyFrame_Struct {
/*056*/
};
struct Checksum_Struct {
uint64 checksum;
uint8 data[2048];
};
struct UpdateMovementEntry {
/* 00 */ float Y;
/* 04 */ float X;
+20 -18
View File
@@ -116,22 +116,24 @@ EQEmuLogSys *EQEmuLogSys::LoadLogSettingsDefaults()
/**
* Set Defaults
*/
log_settings[Logs::WorldServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::ZoneServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::QSServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::UCSServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Crash].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::MySQLError].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Loginserver].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::HeadlessClient].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::NPCScaling].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::HotReload].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::HotReload].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Loot].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::Scheduler].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Cheat].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::HTTP].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::HTTP].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::WorldServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::ZoneServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::QSServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::UCSServer].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Crash].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::MySQLError].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Loginserver].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::HeadlessClient].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::NPCScaling].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::HotReload].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::HotReload].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Loot].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::Scheduler].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Cheat].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::HTTP].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::HTTP].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::ChecksumVerification].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::ChecksumVerification].log_to_gmsay = static_cast<uint8>(Logs::General);
/**
* RFC 5424
@@ -241,7 +243,7 @@ void EQEmuLogSys::ProcessGMSay(
*/
if (EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformZone ||
EQEmuLogSys::log_platform == EQEmuExePlatform::ExePlatformWorld
) {
) {
on_log_gmsay_hook(log_category, message);
}
}
@@ -467,7 +469,7 @@ void EQEmuLogSys::Out(
std::string prefix;
if (RuleB(Logging, PrintFileFunctionAndLine)) {
prefix = fmt::format("[{0}::{1}:{2}] ", base_file_name(file), func, line);
prefix = fmt::format("[{0}:{1}] ", base_file_name(file), line);
}
va_list args;
+2
View File
@@ -127,6 +127,7 @@ namespace Logs {
DiaWind,
HTTP,
Saylink,
ChecksumVerification,
MaxCategoryID /* Don't Remove this */
};
@@ -212,6 +213,7 @@ namespace Logs {
"DialogueWindow",
"HTTP",
"Saylink",
"ChecksumVerification",
};
}
+22
View File
@@ -696,6 +696,16 @@
OutF(LogSys, Logs::Detail, Logs::Saylink, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogChecksumVerification(message, ...) do {\
if (LogSys.log_settings[Logs::ChecksumVerification].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::ChecksumVerification, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogChecksumVerificationDetail(message, ...) do {\
if (LogSys.log_settings[Logs::ChecksumVerification].is_category_enabled == 1)\
OutF(LogSys, Logs::Detail, Logs::ChecksumVerification, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define Log(debug_level, log_category, message, ...) do {\
if (LogSys.log_settings[log_category].is_category_enabled == 1)\
LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
@@ -1092,6 +1102,18 @@
#define LogHTTPDetail(message, ...) do {\
} while (0)
#define LogSaylink(message, ...) do {\
} while (0)
#define LogSaylinkDetail(message, ...) do {\
} while (0)
#define LogChecksumVerification(message, ...) do {\
} while (0)
#define LogChecksumVerificationDetail(message, ...) do {\
} while (0)
#define Log(debug_level, log_category, message, ...) do {\
} while (0)
+14 -5
View File
@@ -30,11 +30,19 @@ struct LootTableEntries_Struct {
float probability;
};
struct ContentFlags {
int16 min_expansion;
int16 max_expansion;
char content_flags[100];
char content_flags_disabled[100];
};
struct LootTable_Struct {
uint32 mincash;
uint32 maxcash;
uint32 avgcoin;
uint32 NumEntries;
uint32 mincash;
uint32 maxcash;
uint32 avgcoin;
uint32 NumEntries;
ContentFlags content_flags;
LootTableEntries_Struct Entries[0];
};
@@ -51,7 +59,8 @@ struct LootDropEntries_Struct {
};
struct LootDrop_Struct {
uint32 NumEntries;
uint32 NumEntries;
ContentFlags content_flags;
LootDropEntries_Struct Entries[0];
};
#pragma pack()
+5
View File
@@ -5218,6 +5218,11 @@ struct SayLinkBodyFrame_Struct {
/*056*/
};
struct Checksum_Struct {
uint64_t checksum;
uint8_t data[2048];
};
}; /*structs*/
}; /*RoF2*/
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAaAbilityRepository {
public:
@@ -59,11 +60,36 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"name",
"category",
"classes",
"races",
"drakkin_heritage",
"deities",
"status",
"type",
"charges",
"grant_only",
"first_rank_id",
"enabled",
"reset_on_death",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("aa_ability");
@@ -73,7 +99,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAaRankEffectsRepository {
public:
@@ -41,11 +42,27 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"rank_id",
"slot",
"effect_id",
"base1",
"base2",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("aa_rank_effects");
@@ -55,7 +72,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAaRankPrereqsRepository {
public:
@@ -37,11 +38,25 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"rank_id",
"aa_id",
"points",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("aa_rank_prereqs");
@@ -51,7 +66,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAaRanksRepository {
public:
@@ -57,11 +58,35 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"upper_hotkey_sid",
"lower_hotkey_sid",
"title_sid",
"desc_sid",
"cost",
"level_req",
"spell",
"spell_type",
"recast_time",
"expansion",
"prev_id",
"next_id",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("aa_ranks");
@@ -71,7 +96,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAccountFlagsRepository {
public:
@@ -37,11 +38,25 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"p_accid",
"p_flag",
"p_value",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("account_flags");
@@ -51,7 +66,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAccountIpRepository {
public:
@@ -39,11 +40,26 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"accid",
"ip",
"count",
"lastused",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("account_ip");
@@ -53,7 +69,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -74,7 +90,7 @@ public:
entry.accid = 0;
entry.ip = "";
entry.count = 1;
entry.lastused = "";
entry.lastused = std::time(nullptr);
return entry;
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAccountRepository {
public:
@@ -32,11 +33,14 @@ public:
std::string minilogin_ip;
int hideme;
int rulesflag;
std::string suspendeduntil;
time_t suspendeduntil;
int time_creation;
int expansion;
std::string ban_reason;
std::string suspend_reason;
std::string crc_eqgame;
std::string crc_skillcaps;
std::string crc_basedata;
};
static std::string PrimaryKey()
@@ -66,6 +70,37 @@ public:
"expansion",
"ban_reason",
"suspend_reason",
"crc_eqgame",
"crc_skillcaps",
"crc_basedata",
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"name",
"charname",
"sharedplat",
"password",
"status",
"ls_id",
"lsaccount_id",
"gmspeed",
"revoked",
"karma",
"minilogin_ip",
"hideme",
"rulesflag",
"UNIX_TIMESTAMP(suspendeduntil)",
"time_creation",
"expansion",
"ban_reason",
"suspend_reason",
"crc_eqgame",
"crc_skillcaps",
"crc_basedata",
};
}
@@ -74,6 +109,11 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("account");
@@ -83,7 +123,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -115,11 +155,14 @@ public:
entry.minilogin_ip = "";
entry.hideme = 0;
entry.rulesflag = 0;
entry.suspendeduntil = "0000-00-00 00:00:00";
entry.suspendeduntil = 0;
entry.time_creation = 0;
entry.expansion = 0;
entry.ban_reason = "";
entry.suspend_reason = "";
entry.crc_eqgame = "";
entry.crc_skillcaps = "";
entry.crc_basedata = "";
return entry;
}
@@ -169,11 +212,14 @@ public:
entry.minilogin_ip = row[11] ? row[11] : "";
entry.hideme = atoi(row[12]);
entry.rulesflag = atoi(row[13]);
entry.suspendeduntil = row[14] ? row[14] : "";
entry.suspendeduntil = strtoll(row[14] ? row[14] : "-1", nullptr, 10);
entry.time_creation = atoi(row[15]);
entry.expansion = atoi(row[16]);
entry.ban_reason = row[17] ? row[17] : "";
entry.suspend_reason = row[18] ? row[18] : "";
entry.crc_eqgame = row[19] ? row[19] : "";
entry.crc_skillcaps = row[20] ? row[20] : "";
entry.crc_basedata = row[21] ? row[21] : "";
return entry;
}
@@ -220,11 +266,14 @@ public:
update_values.push_back(columns[11] + " = '" + EscapeString(account_entry.minilogin_ip) + "'");
update_values.push_back(columns[12] + " = " + std::to_string(account_entry.hideme));
update_values.push_back(columns[13] + " = " + std::to_string(account_entry.rulesflag));
update_values.push_back(columns[14] + " = '" + EscapeString(account_entry.suspendeduntil) + "'");
update_values.push_back(columns[14] + " = FROM_UNIXTIME(" + (account_entry.suspendeduntil > 0 ? std::to_string(account_entry.suspendeduntil) : "null") + ")");
update_values.push_back(columns[15] + " = " + std::to_string(account_entry.time_creation));
update_values.push_back(columns[16] + " = " + std::to_string(account_entry.expansion));
update_values.push_back(columns[17] + " = '" + EscapeString(account_entry.ban_reason) + "'");
update_values.push_back(columns[18] + " = '" + EscapeString(account_entry.suspend_reason) + "'");
update_values.push_back(columns[19] + " = '" + EscapeString(account_entry.crc_eqgame) + "'");
update_values.push_back(columns[20] + " = '" + EscapeString(account_entry.crc_skillcaps) + "'");
update_values.push_back(columns[21] + " = '" + EscapeString(account_entry.crc_basedata) + "'");
auto results = db.QueryDatabase(
fmt::format(
@@ -260,11 +309,14 @@ public:
insert_values.push_back("'" + EscapeString(account_entry.minilogin_ip) + "'");
insert_values.push_back(std::to_string(account_entry.hideme));
insert_values.push_back(std::to_string(account_entry.rulesflag));
insert_values.push_back("'" + EscapeString(account_entry.suspendeduntil) + "'");
insert_values.push_back("FROM_UNIXTIME(" + (account_entry.suspendeduntil > 0 ? std::to_string(account_entry.suspendeduntil) : "null") + ")");
insert_values.push_back(std::to_string(account_entry.time_creation));
insert_values.push_back(std::to_string(account_entry.expansion));
insert_values.push_back("'" + EscapeString(account_entry.ban_reason) + "'");
insert_values.push_back("'" + EscapeString(account_entry.suspend_reason) + "'");
insert_values.push_back("'" + EscapeString(account_entry.crc_eqgame) + "'");
insert_values.push_back("'" + EscapeString(account_entry.crc_skillcaps) + "'");
insert_values.push_back("'" + EscapeString(account_entry.crc_basedata) + "'");
auto results = db.QueryDatabase(
fmt::format(
@@ -308,11 +360,14 @@ public:
insert_values.push_back("'" + EscapeString(account_entry.minilogin_ip) + "'");
insert_values.push_back(std::to_string(account_entry.hideme));
insert_values.push_back(std::to_string(account_entry.rulesflag));
insert_values.push_back("'" + EscapeString(account_entry.suspendeduntil) + "'");
insert_values.push_back("FROM_UNIXTIME(" + (account_entry.suspendeduntil > 0 ? std::to_string(account_entry.suspendeduntil) : "null") + ")");
insert_values.push_back(std::to_string(account_entry.time_creation));
insert_values.push_back(std::to_string(account_entry.expansion));
insert_values.push_back("'" + EscapeString(account_entry.ban_reason) + "'");
insert_values.push_back("'" + EscapeString(account_entry.suspend_reason) + "'");
insert_values.push_back("'" + EscapeString(account_entry.crc_eqgame) + "'");
insert_values.push_back("'" + EscapeString(account_entry.crc_skillcaps) + "'");
insert_values.push_back("'" + EscapeString(account_entry.crc_basedata) + "'");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
@@ -360,11 +415,14 @@ public:
entry.minilogin_ip = row[11] ? row[11] : "";
entry.hideme = atoi(row[12]);
entry.rulesflag = atoi(row[13]);
entry.suspendeduntil = row[14] ? row[14] : "";
entry.suspendeduntil = strtoll(row[14] ? row[14] : "-1", nullptr, 10);
entry.time_creation = atoi(row[15]);
entry.expansion = atoi(row[16]);
entry.ban_reason = row[17] ? row[17] : "";
entry.suspend_reason = row[18] ? row[18] : "";
entry.crc_eqgame = row[19] ? row[19] : "";
entry.crc_skillcaps = row[20] ? row[20] : "";
entry.crc_basedata = row[21] ? row[21] : "";
all_entries.push_back(entry);
}
@@ -403,11 +461,14 @@ public:
entry.minilogin_ip = row[11] ? row[11] : "";
entry.hideme = atoi(row[12]);
entry.rulesflag = atoi(row[13]);
entry.suspendeduntil = row[14] ? row[14] : "";
entry.suspendeduntil = strtoll(row[14] ? row[14] : "-1", nullptr, 10);
entry.time_creation = atoi(row[15]);
entry.expansion = atoi(row[16]);
entry.ban_reason = row[17] ? row[17] : "";
entry.suspend_reason = row[18] ? row[18] : "";
entry.crc_eqgame = row[19] ? row[19] : "";
entry.crc_skillcaps = row[20] ? row[20] : "";
entry.crc_basedata = row[21] ? row[21] : "";
all_entries.push_back(entry);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAccountRewardsRepository {
public:
@@ -37,11 +38,25 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"account_id",
"reward_id",
"amount",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("account_rewards");
@@ -51,7 +66,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAdventureDetailsRepository {
public:
@@ -49,11 +50,31 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"adventure_id",
"instance_id",
"count",
"assassinate_count",
"status",
"time_created",
"time_zoned",
"time_completed",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("adventure_details");
@@ -63,7 +84,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAdventureMembersRepository {
public:
@@ -35,11 +36,24 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"charid",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("adventure_members");
@@ -49,7 +63,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAdventureStatsRepository {
public:
@@ -53,11 +54,33 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"player_id",
"guk_wins",
"mir_wins",
"mmc_wins",
"ruj_wins",
"tak_wins",
"guk_losses",
"mir_losses",
"mmc_losses",
"ruj_losses",
"tak_losses",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("adventure_stats");
@@ -67,7 +90,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAdventureTemplateEntryFlavorRepository {
public:
@@ -35,11 +36,24 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"text",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("adventure_template_entry_flavor");
@@ -49,7 +63,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAdventureTemplateEntryRepository {
public:
@@ -35,11 +36,24 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"template_id",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("adventure_template_entry");
@@ -49,7 +63,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAdventureTemplateRepository {
public:
@@ -97,11 +98,55 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"zone",
"zone_version",
"is_hard",
"is_raid",
"min_level",
"max_level",
"type",
"type_data",
"type_count",
"assa_x",
"assa_y",
"assa_z",
"assa_h",
"text",
"duration",
"zone_in_time",
"win_points",
"lose_points",
"theme",
"zone_in_zone_id",
"zone_in_x",
"zone_in_y",
"zone_in_object_id",
"dest_x",
"dest_y",
"dest_z",
"dest_h",
"graveyard_zone_id",
"graveyard_x",
"graveyard_y",
"graveyard_z",
"graveyard_radius",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("adventure_template");
@@ -111,7 +156,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -148,7 +193,7 @@ public:
entry.zone_in_time = 1800;
entry.win_points = 0;
entry.lose_points = 0;
entry.theme = LDoNThemes::GUK;
entry.theme = 1;
entry.zone_in_zone_id = 0;
entry.zone_in_x = 0;
entry.zone_in_y = 0;
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAlternateCurrencyRepository {
public:
@@ -35,11 +36,24 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"item_id",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("alternate_currency");
@@ -49,7 +63,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseAurasRepository {
public:
@@ -53,11 +54,33 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"type",
"npc_type",
"name",
"spell_id",
"distance",
"aura_type",
"spawn_type",
"movement",
"duration",
"icon",
"cast_time",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("auras");
@@ -67,7 +90,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseBaseDataRepository {
public:
@@ -51,11 +52,32 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"level",
"`class`",
"hp",
"mana",
"end",
"unk1",
"unk2",
"hp_fac",
"mana_fac",
"end_fac",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("base_data");
@@ -65,7 +87,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseBlockedSpellsRepository {
public:
@@ -55,11 +56,34 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"spellid",
"type",
"zoneid",
"x",
"y",
"z",
"x_diff",
"y_diff",
"z_diff",
"message",
"description",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("blocked_spells");
@@ -69,7 +93,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -0,0 +1,326 @@
/**
* DO NOT MODIFY THIS FILE
*
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
#ifndef EQEMU_BASE_BOOKS_REPOSITORY_H
#define EQEMU_BASE_BOOKS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseBooksRepository {
public:
struct Books {
int id;
std::string name;
std::string txtfile;
int language;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"name",
"txtfile",
"language",
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"name",
"txtfile",
"language",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("books");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static Books NewEntity()
{
Books entry{};
entry.id = 0;
entry.name = "";
entry.txtfile = "";
entry.language = 0;
return entry;
}
static Books GetBooksEntry(
const std::vector<Books> &bookss,
int books_id
)
{
for (auto &books : bookss) {
if (books.id == books_id) {
return books;
}
}
return NewEntity();
}
static Books FindOne(
Database& db,
int books_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
books_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
Books entry{};
entry.id = atoi(row[0]);
entry.name = row[1] ? row[1] : "";
entry.txtfile = row[2] ? row[2] : "";
entry.language = atoi(row[3]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int books_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
books_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
Books books_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[1] + " = '" + EscapeString(books_entry.name) + "'");
update_values.push_back(columns[2] + " = '" + EscapeString(books_entry.txtfile) + "'");
update_values.push_back(columns[3] + " = " + std::to_string(books_entry.language));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
books_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static Books InsertOne(
Database& db,
Books books_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(books_entry.id));
insert_values.push_back("'" + EscapeString(books_entry.name) + "'");
insert_values.push_back("'" + EscapeString(books_entry.txtfile) + "'");
insert_values.push_back(std::to_string(books_entry.language));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
books_entry.id = results.LastInsertedID();
return books_entry;
}
books_entry = NewEntity();
return books_entry;
}
static int InsertMany(
Database& db,
std::vector<Books> books_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &books_entry: books_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(books_entry.id));
insert_values.push_back("'" + EscapeString(books_entry.name) + "'");
insert_values.push_back("'" + EscapeString(books_entry.txtfile) + "'");
insert_values.push_back(std::to_string(books_entry.language));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<Books> All(Database& db)
{
std::vector<Books> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
Books entry{};
entry.id = atoi(row[0]);
entry.name = row[1] ? row[1] : "";
entry.txtfile = row[2] ? row[2] : "";
entry.language = atoi(row[3]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<Books> GetWhere(Database& db, std::string where_filter)
{
std::vector<Books> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
Books entry{};
entry.id = atoi(row[0]);
entry.name = row[1] ? row[1] : "";
entry.txtfile = row[2] ? row[2] : "";
entry.language = atoi(row[3]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate(Database& db)
{
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_BOOKS_REPOSITORY_H
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseBugReportsRepository {
public:
@@ -45,9 +46,9 @@ public:
int _unknown_value;
std::string bug_report;
std::string system_info;
std::string report_datetime;
time_t report_datetime;
int bug_status;
std::string last_review;
time_t last_review;
std::string last_reviewer;
std::string reviewer_notes;
};
@@ -95,11 +96,54 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"zone",
"client_version_id",
"client_version_name",
"account_id",
"character_id",
"character_name",
"reporter_spoof",
"category_id",
"category_name",
"reporter_name",
"ui_path",
"pos_x",
"pos_y",
"pos_z",
"heading",
"time_played",
"target_id",
"target_name",
"optional_info_mask",
"_can_duplicate",
"_crash_bug",
"_target_info",
"_character_flags",
"_unknown_value",
"bug_report",
"system_info",
"UNIX_TIMESTAMP(report_datetime)",
"bug_status",
"UNIX_TIMESTAMP(last_review)",
"last_reviewer",
"reviewer_notes",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("bug_reports");
@@ -109,7 +153,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -154,9 +198,9 @@ public:
entry._unknown_value = 0;
entry.bug_report = "";
entry.system_info = "";
entry.report_datetime = "";
entry.report_datetime = std::time(nullptr);
entry.bug_status = 0;
entry.last_review = "";
entry.last_review = std::time(nullptr);
entry.last_reviewer = "None";
entry.reviewer_notes = "";
@@ -221,9 +265,9 @@ public:
entry._unknown_value = atoi(row[24]);
entry.bug_report = row[25] ? row[25] : "";
entry.system_info = row[26] ? row[26] : "";
entry.report_datetime = row[27] ? row[27] : "";
entry.report_datetime = strtoll(row[27] ? row[27] : "-1", nullptr, 10);
entry.bug_status = atoi(row[28]);
entry.last_review = row[29] ? row[29] : "";
entry.last_review = strtoll(row[29] ? row[29] : "-1", nullptr, 10);
entry.last_reviewer = row[30] ? row[30] : "";
entry.reviewer_notes = row[31] ? row[31] : "";
@@ -285,9 +329,9 @@ public:
update_values.push_back(columns[24] + " = " + std::to_string(bug_reports_entry._unknown_value));
update_values.push_back(columns[25] + " = '" + EscapeString(bug_reports_entry.bug_report) + "'");
update_values.push_back(columns[26] + " = '" + EscapeString(bug_reports_entry.system_info) + "'");
update_values.push_back(columns[27] + " = '" + EscapeString(bug_reports_entry.report_datetime) + "'");
update_values.push_back(columns[27] + " = FROM_UNIXTIME(" + (bug_reports_entry.report_datetime > 0 ? std::to_string(bug_reports_entry.report_datetime) : "null") + ")");
update_values.push_back(columns[28] + " = " + std::to_string(bug_reports_entry.bug_status));
update_values.push_back(columns[29] + " = '" + EscapeString(bug_reports_entry.last_review) + "'");
update_values.push_back(columns[29] + " = FROM_UNIXTIME(" + (bug_reports_entry.last_review > 0 ? std::to_string(bug_reports_entry.last_review) : "null") + ")");
update_values.push_back(columns[30] + " = '" + EscapeString(bug_reports_entry.last_reviewer) + "'");
update_values.push_back(columns[31] + " = '" + EscapeString(bug_reports_entry.reviewer_notes) + "'");
@@ -338,9 +382,9 @@ public:
insert_values.push_back(std::to_string(bug_reports_entry._unknown_value));
insert_values.push_back("'" + EscapeString(bug_reports_entry.bug_report) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.system_info) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.report_datetime) + "'");
insert_values.push_back("FROM_UNIXTIME(" + (bug_reports_entry.report_datetime > 0 ? std::to_string(bug_reports_entry.report_datetime) : "null") + ")");
insert_values.push_back(std::to_string(bug_reports_entry.bug_status));
insert_values.push_back("'" + EscapeString(bug_reports_entry.last_review) + "'");
insert_values.push_back("FROM_UNIXTIME(" + (bug_reports_entry.last_review > 0 ? std::to_string(bug_reports_entry.last_review) : "null") + ")");
insert_values.push_back("'" + EscapeString(bug_reports_entry.last_reviewer) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.reviewer_notes) + "'");
@@ -399,9 +443,9 @@ public:
insert_values.push_back(std::to_string(bug_reports_entry._unknown_value));
insert_values.push_back("'" + EscapeString(bug_reports_entry.bug_report) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.system_info) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.report_datetime) + "'");
insert_values.push_back("FROM_UNIXTIME(" + (bug_reports_entry.report_datetime > 0 ? std::to_string(bug_reports_entry.report_datetime) : "null") + ")");
insert_values.push_back(std::to_string(bug_reports_entry.bug_status));
insert_values.push_back("'" + EscapeString(bug_reports_entry.last_review) + "'");
insert_values.push_back("FROM_UNIXTIME(" + (bug_reports_entry.last_review > 0 ? std::to_string(bug_reports_entry.last_review) : "null") + ")");
insert_values.push_back("'" + EscapeString(bug_reports_entry.last_reviewer) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.reviewer_notes) + "'");
@@ -464,9 +508,9 @@ public:
entry._unknown_value = atoi(row[24]);
entry.bug_report = row[25] ? row[25] : "";
entry.system_info = row[26] ? row[26] : "";
entry.report_datetime = row[27] ? row[27] : "";
entry.report_datetime = strtoll(row[27] ? row[27] : "-1", nullptr, 10);
entry.bug_status = atoi(row[28]);
entry.last_review = row[29] ? row[29] : "";
entry.last_review = strtoll(row[29] ? row[29] : "-1", nullptr, 10);
entry.last_reviewer = row[30] ? row[30] : "";
entry.reviewer_notes = row[31] ? row[31] : "";
@@ -520,9 +564,9 @@ public:
entry._unknown_value = atoi(row[24]);
entry.bug_report = row[25] ? row[25] : "";
entry.system_info = row[26] ? row[26] : "";
entry.report_datetime = row[27] ? row[27] : "";
entry.report_datetime = strtoll(row[27] ? row[27] : "-1", nullptr, 10);
entry.bug_status = atoi(row[28]);
entry.last_review = row[29] ? row[29] : "";
entry.last_review = strtoll(row[29] ? row[29] : "-1", nullptr, 10);
entry.last_reviewer = row[30] ? row[30] : "";
entry.reviewer_notes = row[31] ? row[31] : "";
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseBugsRepository {
public:
@@ -57,11 +58,35 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"zone",
"name",
"ui",
"x",
"y",
"z",
"type",
"flag",
"target",
"bug",
"date",
"status",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("bugs");
@@ -71,7 +96,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseBuyerRepository {
public:
@@ -43,11 +44,28 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"charid",
"buyslot",
"itemid",
"itemname",
"quantity",
"price",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("buyer");
@@ -57,7 +75,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharCreateCombinationsRepository {
public:
@@ -43,11 +44,28 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"allocation_id",
"race",
"`class`",
"deity",
"start_zone",
"expansions_req",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("char_create_combinations");
@@ -57,7 +75,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharCreatePointAllocationsRepository {
public:
@@ -61,11 +62,37 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"base_str",
"base_sta",
"base_dex",
"base_agi",
"base_int",
"base_wis",
"base_cha",
"alloc_str",
"alloc_sta",
"alloc_dex",
"alloc_agi",
"alloc_int",
"alloc_wis",
"alloc_cha",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("char_create_point_allocations");
@@ -75,7 +102,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharRecipeListRepository {
public:
@@ -37,11 +38,25 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"char_id",
"recipe_id",
"madecount",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("char_recipe_list");
@@ -51,7 +66,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterActivitiesRepository {
public:
@@ -41,11 +42,27 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"charid",
"taskid",
"activityid",
"donecount",
"completed",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_activities");
@@ -55,7 +72,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterAltCurrencyRepository {
public:
@@ -37,11 +38,25 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"char_id",
"currency_id",
"amount",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_alt_currency");
@@ -51,7 +66,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterAlternateAbilitiesRepository {
public:
@@ -39,11 +40,26 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"aa_id",
"aa_value",
"charges",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_alternate_abilities");
@@ -53,7 +69,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterAurasRepository {
public:
@@ -37,11 +38,25 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"slot",
"spell_id",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_auras");
@@ -51,7 +66,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterBandolierRepository {
public:
@@ -43,11 +44,28 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"bandolier_id",
"bandolier_slot",
"item_id",
"icon",
"bandolier_name",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_bandolier");
@@ -57,7 +75,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterBindRepository {
public:
@@ -47,11 +48,30 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"slot",
"zone_id",
"instance_id",
"x",
"y",
"z",
"heading",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_bind");
@@ -61,7 +81,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterBuffsRepository {
public:
@@ -65,11 +66,39 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"character_id",
"slot_id",
"spell_id",
"caster_level",
"caster_name",
"ticsremaining",
"counters",
"numhits",
"melee_rune",
"magic_rune",
"persistent",
"dot_rune",
"caston_x",
"caston_y",
"caston_z",
"ExtraDIChance",
"instrument_mod",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_buffs");
@@ -79,7 +108,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterCorpseItemsRepository {
public:
@@ -53,11 +54,33 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"corpse_id",
"equip_slot",
"item_id",
"charges",
"aug_1",
"aug_2",
"aug_3",
"aug_4",
"aug_5",
"aug_6",
"attuned",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_corpse_items");
@@ -67,7 +90,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterCorpsesRepository {
public:
@@ -27,7 +28,7 @@ public:
float y;
float z;
float heading;
std::string time_of_death;
time_t time_of_death;
int guild_consent_id;
int is_rezzed;
int is_buried;
@@ -125,11 +126,69 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"charid",
"charname",
"zone_id",
"instance_id",
"x",
"y",
"z",
"heading",
"UNIX_TIMESTAMP(time_of_death)",
"guild_consent_id",
"is_rezzed",
"is_buried",
"was_at_graveyard",
"is_locked",
"exp",
"size",
"level",
"race",
"gender",
"`class`",
"deity",
"texture",
"helm_texture",
"copper",
"silver",
"gold",
"platinum",
"hair_color",
"beard_color",
"eye_color_1",
"eye_color_2",
"hair_style",
"face",
"beard",
"drakkin_heritage",
"drakkin_tattoo",
"drakkin_details",
"wc_1",
"wc_2",
"wc_3",
"wc_4",
"wc_5",
"wc_6",
"wc_7",
"wc_8",
"wc_9",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_corpses");
@@ -139,7 +198,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -166,7 +225,7 @@ public:
entry.y = 0;
entry.z = 0;
entry.heading = 0;
entry.time_of_death = "0000-00-00 00:00:00";
entry.time_of_death = 0;
entry.guild_consent_id = 0;
entry.is_rezzed = 0;
entry.is_buried = 0;
@@ -248,7 +307,7 @@ public:
entry.y = static_cast<float>(atof(row[6]));
entry.z = static_cast<float>(atof(row[7]));
entry.heading = static_cast<float>(atof(row[8]));
entry.time_of_death = row[9] ? row[9] : "";
entry.time_of_death = strtoll(row[9] ? row[9] : "-1", nullptr, 10);
entry.guild_consent_id = atoi(row[10]);
entry.is_rezzed = atoi(row[11]);
entry.is_buried = atoi(row[12]);
@@ -327,7 +386,7 @@ public:
update_values.push_back(columns[6] + " = " + std::to_string(character_corpses_entry.y));
update_values.push_back(columns[7] + " = " + std::to_string(character_corpses_entry.z));
update_values.push_back(columns[8] + " = " + std::to_string(character_corpses_entry.heading));
update_values.push_back(columns[9] + " = '" + EscapeString(character_corpses_entry.time_of_death) + "'");
update_values.push_back(columns[9] + " = FROM_UNIXTIME(" + (character_corpses_entry.time_of_death > 0 ? std::to_string(character_corpses_entry.time_of_death) : "null") + ")");
update_values.push_back(columns[10] + " = " + std::to_string(character_corpses_entry.guild_consent_id));
update_values.push_back(columns[11] + " = " + std::to_string(character_corpses_entry.is_rezzed));
update_values.push_back(columns[12] + " = " + std::to_string(character_corpses_entry.is_buried));
@@ -395,7 +454,7 @@ public:
insert_values.push_back(std::to_string(character_corpses_entry.y));
insert_values.push_back(std::to_string(character_corpses_entry.z));
insert_values.push_back(std::to_string(character_corpses_entry.heading));
insert_values.push_back("'" + EscapeString(character_corpses_entry.time_of_death) + "'");
insert_values.push_back("FROM_UNIXTIME(" + (character_corpses_entry.time_of_death > 0 ? std::to_string(character_corpses_entry.time_of_death) : "null") + ")");
insert_values.push_back(std::to_string(character_corpses_entry.guild_consent_id));
insert_values.push_back(std::to_string(character_corpses_entry.is_rezzed));
insert_values.push_back(std::to_string(character_corpses_entry.is_buried));
@@ -471,7 +530,7 @@ public:
insert_values.push_back(std::to_string(character_corpses_entry.y));
insert_values.push_back(std::to_string(character_corpses_entry.z));
insert_values.push_back(std::to_string(character_corpses_entry.heading));
insert_values.push_back("'" + EscapeString(character_corpses_entry.time_of_death) + "'");
insert_values.push_back("FROM_UNIXTIME(" + (character_corpses_entry.time_of_death > 0 ? std::to_string(character_corpses_entry.time_of_death) : "null") + ")");
insert_values.push_back(std::to_string(character_corpses_entry.guild_consent_id));
insert_values.push_back(std::to_string(character_corpses_entry.is_rezzed));
insert_values.push_back(std::to_string(character_corpses_entry.is_buried));
@@ -551,7 +610,7 @@ public:
entry.y = static_cast<float>(atof(row[6]));
entry.z = static_cast<float>(atof(row[7]));
entry.heading = static_cast<float>(atof(row[8]));
entry.time_of_death = row[9] ? row[9] : "";
entry.time_of_death = strtoll(row[9] ? row[9] : "-1", nullptr, 10);
entry.guild_consent_id = atoi(row[10]);
entry.is_rezzed = atoi(row[11]);
entry.is_buried = atoi(row[12]);
@@ -622,7 +681,7 @@ public:
entry.y = static_cast<float>(atof(row[6]));
entry.z = static_cast<float>(atof(row[7]));
entry.heading = static_cast<float>(atof(row[8]));
entry.time_of_death = row[9] ? row[9] : "";
entry.time_of_death = strtoll(row[9] ? row[9] : "-1", nullptr, 10);
entry.guild_consent_id = atoi(row[10]);
entry.is_rezzed = atoi(row[11]);
entry.is_buried = atoi(row[12]);
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterCurrencyRepository {
public:
@@ -65,11 +66,39 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"platinum",
"gold",
"silver",
"copper",
"platinum_bank",
"gold_bank",
"silver_bank",
"copper_bank",
"platinum_cursor",
"gold_cursor",
"silver_cursor",
"copper_cursor",
"radiant_crystals",
"career_radiant_crystals",
"ebon_crystals",
"career_ebon_crystals",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_currency");
@@ -79,7 +108,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterDataRepository {
public:
@@ -119,7 +120,7 @@ public:
int aa_points_spent_old;
int aa_points_old;
int e_last_invsnapshot;
std::string deleted_at;
time_t deleted_at;
};
static std::string PrimaryKey()
@@ -235,11 +236,124 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"account_id",
"name",
"last_name",
"title",
"suffix",
"zone_id",
"zone_instance",
"y",
"x",
"z",
"heading",
"gender",
"race",
"`class`",
"level",
"deity",
"birthday",
"last_login",
"time_played",
"level2",
"anon",
"gm",
"face",
"hair_color",
"hair_style",
"beard",
"beard_color",
"eye_color_1",
"eye_color_2",
"drakkin_heritage",
"drakkin_tattoo",
"drakkin_details",
"ability_time_seconds",
"ability_number",
"ability_time_minutes",
"ability_time_hours",
"exp",
"aa_points_spent",
"aa_exp",
"aa_points",
"group_leadership_exp",
"raid_leadership_exp",
"group_leadership_points",
"raid_leadership_points",
"points",
"cur_hp",
"mana",
"endurance",
"intoxication",
"str",
"sta",
"cha",
"dex",
"`int`",
"agi",
"wis",
"zone_change_count",
"toxicity",
"hunger_level",
"thirst_level",
"ability_up",
"ldon_points_guk",
"ldon_points_mir",
"ldon_points_mmc",
"ldon_points_ruj",
"ldon_points_tak",
"ldon_points_available",
"tribute_time_remaining",
"career_tribute_points",
"tribute_points",
"tribute_active",
"pvp_status",
"pvp_kills",
"pvp_deaths",
"pvp_current_points",
"pvp_career_points",
"pvp_best_kill_streak",
"pvp_worst_death_streak",
"pvp_current_kill_streak",
"pvp2",
"pvp_type",
"show_helm",
"group_auto_consent",
"raid_auto_consent",
"guild_auto_consent",
"leadership_exp_on",
"RestTimer",
"air_remaining",
"autosplit_enabled",
"lfp",
"lfg",
"mailkey",
"xtargets",
"firstlogon",
"e_aa_effects",
"e_percent_to_aa",
"e_expended_aa_spent",
"aa_points_spent_old",
"aa_points_old",
"e_last_invsnapshot",
"UNIX_TIMESTAMP(deleted_at)",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_data");
@@ -249,7 +363,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -368,7 +482,7 @@ public:
entry.aa_points_spent_old = 0;
entry.aa_points_old = 0;
entry.e_last_invsnapshot = 0;
entry.deleted_at = "";
entry.deleted_at = 0;
return entry;
}
@@ -505,7 +619,7 @@ public:
entry.aa_points_spent_old = atoi(row[98]);
entry.aa_points_old = atoi(row[99]);
entry.e_last_invsnapshot = atoi(row[100]);
entry.deleted_at = row[101] ? row[101] : "";
entry.deleted_at = strtoll(row[101] ? row[101] : "-1", nullptr, 10);
return entry;
}
@@ -639,7 +753,7 @@ public:
update_values.push_back(columns[98] + " = " + std::to_string(character_data_entry.aa_points_spent_old));
update_values.push_back(columns[99] + " = " + std::to_string(character_data_entry.aa_points_old));
update_values.push_back(columns[100] + " = " + std::to_string(character_data_entry.e_last_invsnapshot));
update_values.push_back(columns[101] + " = '" + EscapeString(character_data_entry.deleted_at) + "'");
update_values.push_back(columns[101] + " = FROM_UNIXTIME(" + (character_data_entry.deleted_at > 0 ? std::to_string(character_data_entry.deleted_at) : "null") + ")");
auto results = db.QueryDatabase(
fmt::format(
@@ -762,7 +876,7 @@ public:
insert_values.push_back(std::to_string(character_data_entry.aa_points_spent_old));
insert_values.push_back(std::to_string(character_data_entry.aa_points_old));
insert_values.push_back(std::to_string(character_data_entry.e_last_invsnapshot));
insert_values.push_back("'" + EscapeString(character_data_entry.deleted_at) + "'");
insert_values.push_back("FROM_UNIXTIME(" + (character_data_entry.deleted_at > 0 ? std::to_string(character_data_entry.deleted_at) : "null") + ")");
auto results = db.QueryDatabase(
fmt::format(
@@ -893,7 +1007,7 @@ public:
insert_values.push_back(std::to_string(character_data_entry.aa_points_spent_old));
insert_values.push_back(std::to_string(character_data_entry.aa_points_old));
insert_values.push_back(std::to_string(character_data_entry.e_last_invsnapshot));
insert_values.push_back("'" + EscapeString(character_data_entry.deleted_at) + "'");
insert_values.push_back("FROM_UNIXTIME(" + (character_data_entry.deleted_at > 0 ? std::to_string(character_data_entry.deleted_at) : "null") + ")");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
@@ -1028,7 +1142,7 @@ public:
entry.aa_points_spent_old = atoi(row[98]);
entry.aa_points_old = atoi(row[99]);
entry.e_last_invsnapshot = atoi(row[100]);
entry.deleted_at = row[101] ? row[101] : "";
entry.deleted_at = strtoll(row[101] ? row[101] : "-1", nullptr, 10);
all_entries.push_back(entry);
}
@@ -1154,7 +1268,7 @@ public:
entry.aa_points_spent_old = atoi(row[98]);
entry.aa_points_old = atoi(row[99]);
entry.e_last_invsnapshot = atoi(row[100]);
entry.deleted_at = row[101] ? row[101] : "";
entry.deleted_at = strtoll(row[101] ? row[101] : "-1", nullptr, 10);
all_entries.push_back(entry);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterDisciplinesRepository {
public:
@@ -37,11 +38,25 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"slot_id",
"disc_id",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_disciplines");
@@ -51,7 +66,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -0,0 +1,327 @@
/**
* DO NOT MODIFY THIS FILE
*
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
#ifndef EQEMU_BASE_CHARACTER_EXP_MODIFIERS_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_EXP_MODIFIERS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterExpModifiersRepository {
public:
struct CharacterExpModifiers {
int character_id;
int zone_id;
float aa_modifier;
float exp_modifier;
};
static std::string PrimaryKey()
{
return std::string("character_id");
}
static std::vector<std::string> Columns()
{
return {
"character_id",
"zone_id",
"aa_modifier",
"exp_modifier",
};
}
static std::vector<std::string> SelectColumns()
{
return {
"character_id",
"zone_id",
"aa_modifier",
"exp_modifier",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_exp_modifiers");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static CharacterExpModifiers NewEntity()
{
CharacterExpModifiers entry{};
entry.character_id = 0;
entry.zone_id = 0;
entry.aa_modifier = 0;
entry.exp_modifier = 0;
return entry;
}
static CharacterExpModifiers GetCharacterExpModifiersEntry(
const std::vector<CharacterExpModifiers> &character_exp_modifierss,
int character_exp_modifiers_id
)
{
for (auto &character_exp_modifiers : character_exp_modifierss) {
if (character_exp_modifiers.character_id == character_exp_modifiers_id) {
return character_exp_modifiers;
}
}
return NewEntity();
}
static CharacterExpModifiers FindOne(
Database& db,
int character_exp_modifiers_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_exp_modifiers_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterExpModifiers entry{};
entry.character_id = atoi(row[0]);
entry.zone_id = atoi(row[1]);
entry.aa_modifier = static_cast<float>(atof(row[2]));
entry.exp_modifier = static_cast<float>(atof(row[3]));
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int character_exp_modifiers_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_exp_modifiers_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
CharacterExpModifiers character_exp_modifiers_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(character_exp_modifiers_entry.character_id));
update_values.push_back(columns[1] + " = " + std::to_string(character_exp_modifiers_entry.zone_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_exp_modifiers_entry.aa_modifier));
update_values.push_back(columns[3] + " = " + std::to_string(character_exp_modifiers_entry.exp_modifier));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_exp_modifiers_entry.character_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterExpModifiers InsertOne(
Database& db,
CharacterExpModifiers character_exp_modifiers_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_exp_modifiers_entry.character_id));
insert_values.push_back(std::to_string(character_exp_modifiers_entry.zone_id));
insert_values.push_back(std::to_string(character_exp_modifiers_entry.aa_modifier));
insert_values.push_back(std::to_string(character_exp_modifiers_entry.exp_modifier));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_exp_modifiers_entry.character_id = results.LastInsertedID();
return character_exp_modifiers_entry;
}
character_exp_modifiers_entry = NewEntity();
return character_exp_modifiers_entry;
}
static int InsertMany(
Database& db,
std::vector<CharacterExpModifiers> character_exp_modifiers_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_exp_modifiers_entry: character_exp_modifiers_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_exp_modifiers_entry.character_id));
insert_values.push_back(std::to_string(character_exp_modifiers_entry.zone_id));
insert_values.push_back(std::to_string(character_exp_modifiers_entry.aa_modifier));
insert_values.push_back(std::to_string(character_exp_modifiers_entry.exp_modifier));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterExpModifiers> All(Database& db)
{
std::vector<CharacterExpModifiers> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterExpModifiers entry{};
entry.character_id = atoi(row[0]);
entry.zone_id = atoi(row[1]);
entry.aa_modifier = static_cast<float>(atof(row[2]));
entry.exp_modifier = static_cast<float>(atof(row[3]));
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterExpModifiers> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterExpModifiers> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterExpModifiers entry{};
entry.character_id = atoi(row[0]);
entry.zone_id = atoi(row[1]);
entry.aa_modifier = static_cast<float>(atof(row[2]));
entry.exp_modifier = static_cast<float>(atof(row[3]));
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate(Database& db)
{
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_CHARACTER_EXP_MODIFIERS_REPOSITORY_H
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterExpeditionLockoutsRepository {
public:
@@ -22,7 +23,7 @@ public:
int character_id;
std::string expedition_name;
std::string event_name;
std::string expire_time;
time_t expire_time;
int duration;
std::string from_expedition_uuid;
};
@@ -45,11 +46,29 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"character_id",
"expedition_name",
"event_name",
"UNIX_TIMESTAMP(expire_time)",
"duration",
"from_expedition_uuid",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_expedition_lockouts");
@@ -59,7 +78,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -81,7 +100,7 @@ public:
entry.character_id = 0;
entry.expedition_name = "";
entry.event_name = "";
entry.expire_time = "";
entry.expire_time = std::time(nullptr);
entry.duration = 0;
entry.from_expedition_uuid = "";
@@ -123,7 +142,7 @@ public:
entry.character_id = atoi(row[1]);
entry.expedition_name = row[2] ? row[2] : "";
entry.event_name = row[3] ? row[3] : "";
entry.expire_time = row[4] ? row[4] : "";
entry.expire_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
entry.duration = atoi(row[5]);
entry.from_expedition_uuid = row[6] ? row[6] : "";
@@ -162,7 +181,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_expedition_lockouts_entry.character_id));
update_values.push_back(columns[2] + " = '" + EscapeString(character_expedition_lockouts_entry.expedition_name) + "'");
update_values.push_back(columns[3] + " = '" + EscapeString(character_expedition_lockouts_entry.event_name) + "'");
update_values.push_back(columns[4] + " = '" + EscapeString(character_expedition_lockouts_entry.expire_time) + "'");
update_values.push_back(columns[4] + " = FROM_UNIXTIME(" + (character_expedition_lockouts_entry.expire_time > 0 ? std::to_string(character_expedition_lockouts_entry.expire_time) : "null") + ")");
update_values.push_back(columns[5] + " = " + std::to_string(character_expedition_lockouts_entry.duration));
update_values.push_back(columns[6] + " = '" + EscapeString(character_expedition_lockouts_entry.from_expedition_uuid) + "'");
@@ -190,7 +209,7 @@ public:
insert_values.push_back(std::to_string(character_expedition_lockouts_entry.character_id));
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.expedition_name) + "'");
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.event_name) + "'");
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.expire_time) + "'");
insert_values.push_back("FROM_UNIXTIME(" + (character_expedition_lockouts_entry.expire_time > 0 ? std::to_string(character_expedition_lockouts_entry.expire_time) : "null") + ")");
insert_values.push_back(std::to_string(character_expedition_lockouts_entry.duration));
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.from_expedition_uuid) + "'");
@@ -226,7 +245,7 @@ public:
insert_values.push_back(std::to_string(character_expedition_lockouts_entry.character_id));
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.expedition_name) + "'");
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.event_name) + "'");
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.expire_time) + "'");
insert_values.push_back("FROM_UNIXTIME(" + (character_expedition_lockouts_entry.expire_time > 0 ? std::to_string(character_expedition_lockouts_entry.expire_time) : "null") + ")");
insert_values.push_back(std::to_string(character_expedition_lockouts_entry.duration));
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.from_expedition_uuid) + "'");
@@ -266,7 +285,7 @@ public:
entry.character_id = atoi(row[1]);
entry.expedition_name = row[2] ? row[2] : "";
entry.event_name = row[3] ? row[3] : "";
entry.expire_time = row[4] ? row[4] : "";
entry.expire_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
entry.duration = atoi(row[5]);
entry.from_expedition_uuid = row[6] ? row[6] : "";
@@ -297,7 +316,7 @@ public:
entry.character_id = atoi(row[1]);
entry.expedition_name = row[2] ? row[2] : "";
entry.event_name = row[3] ? row[3] : "";
entry.expire_time = row[4] ? row[4] : "";
entry.expire_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
entry.duration = atoi(row[5]);
entry.from_expedition_uuid = row[6] ? row[6] : "";
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterInspectMessagesRepository {
public:
@@ -35,11 +36,24 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"inspect_message",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_inspect_messages");
@@ -49,7 +63,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterInstanceSafereturnsRepository {
public:
@@ -49,11 +50,31 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"character_id",
"instance_zone_id",
"instance_id",
"safe_zone_id",
"safe_x",
"safe_y",
"safe_z",
"safe_heading",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_instance_safereturns");
@@ -63,7 +84,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterItemRecastRepository {
public:
@@ -37,11 +38,25 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"recast_type",
"timestamp",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_item_recast");
@@ -51,7 +66,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterLanguagesRepository {
public:
@@ -37,11 +38,25 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"lang_id",
"value",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_languages");
@@ -51,7 +66,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterLeadershipAbilitiesRepository {
public:
@@ -37,11 +38,25 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"slot",
"rank",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_leadership_abilities");
@@ -51,7 +66,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterMaterialRepository {
public:
@@ -45,11 +46,29 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"slot",
"blue",
"green",
"red",
"use_tint",
"color",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_material");
@@ -59,7 +78,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterMemmedSpellsRepository {
public:
@@ -37,11 +38,25 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"slot_id",
"spell_id",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_memmed_spells");
@@ -51,7 +66,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterPetBuffsRepository {
public:
@@ -53,11 +54,33 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"char_id",
"pet",
"slot",
"spell_id",
"caster_level",
"castername",
"ticsremaining",
"counters",
"numhits",
"rune",
"instrument_mod",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_pet_buffs");
@@ -67,7 +90,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterPetInfoRepository {
public:
@@ -49,11 +50,31 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"char_id",
"pet",
"petname",
"petpower",
"spell_id",
"hp",
"mana",
"size",
"taunting",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_pet_info");
@@ -63,7 +84,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterPetInventoryRepository {
public:
@@ -39,11 +40,26 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"char_id",
"pet",
"slot",
"item_id",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_pet_inventory");
@@ -53,7 +69,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterPotionbeltRepository {
public:
@@ -39,11 +40,26 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"potion_id",
"item_id",
"icon",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_potionbelt");
@@ -53,7 +69,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterSkillsRepository {
public:
@@ -37,11 +38,25 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"skill_id",
"value",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_skills");
@@ -51,7 +66,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterSpellsRepository {
public:
@@ -37,11 +38,25 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"slot_id",
"spell_id",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_spells");
@@ -51,7 +66,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -134,7 +134,7 @@ public:
entry.character_id = atoi(row[1]);
entry.task_id = atoi(row[2]);
entry.timer_type = atoi(row[3]);
entry.expire_time = strtoll(row[4], nullptr, 10);
entry.expire_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
return entry;
}
@@ -171,7 +171,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_task_timers_entry.character_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_task_timers_entry.task_id));
update_values.push_back(columns[3] + " = " + std::to_string(character_task_timers_entry.timer_type));
update_values.push_back(columns[4] + " = FROM_UNIXTIME(" + std::to_string(character_task_timers_entry.expire_time) + ")");
update_values.push_back(columns[4] + " = FROM_UNIXTIME(" + (character_task_timers_entry.expire_time > 0 ? std::to_string(character_task_timers_entry.expire_time) : "null") + ")");
auto results = db.QueryDatabase(
fmt::format(
@@ -197,7 +197,7 @@ public:
insert_values.push_back(std::to_string(character_task_timers_entry.character_id));
insert_values.push_back(std::to_string(character_task_timers_entry.task_id));
insert_values.push_back(std::to_string(character_task_timers_entry.timer_type));
insert_values.push_back("FROM_UNIXTIME(" + std::to_string(character_task_timers_entry.expire_time) + ")");
insert_values.push_back("FROM_UNIXTIME(" + (character_task_timers_entry.expire_time > 0 ? std::to_string(character_task_timers_entry.expire_time) : "null") + ")");
auto results = db.QueryDatabase(
fmt::format(
@@ -231,7 +231,7 @@ public:
insert_values.push_back(std::to_string(character_task_timers_entry.character_id));
insert_values.push_back(std::to_string(character_task_timers_entry.task_id));
insert_values.push_back(std::to_string(character_task_timers_entry.timer_type));
insert_values.push_back("FROM_UNIXTIME(" + std::to_string(character_task_timers_entry.expire_time) + ")");
insert_values.push_back("FROM_UNIXTIME(" + (character_task_timers_entry.expire_time > 0 ? std::to_string(character_task_timers_entry.expire_time) : "null") + ")");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
@@ -269,7 +269,7 @@ public:
entry.character_id = atoi(row[1]);
entry.task_id = atoi(row[2]);
entry.timer_type = atoi(row[3]);
entry.expire_time = strtoll(row[4], nullptr, 10);
entry.expire_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
all_entries.push_back(entry);
}
@@ -298,7 +298,7 @@ public:
entry.character_id = atoi(row[1]);
entry.task_id = atoi(row[2]);
entry.timer_type = atoi(row[3]);
entry.expire_time = strtoll(row[4], nullptr, 10);
entry.expire_time = strtoll(row[4] ? row[4] : "-1", nullptr, 10);
all_entries.push_back(entry);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCharacterTasksRepository {
public:
@@ -41,11 +42,27 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"charid",
"taskid",
"slot",
"type",
"acceptedtime",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_tasks");
@@ -55,7 +72,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseCompletedTasksRepository {
public:
@@ -39,11 +40,26 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"charid",
"completedtime",
"taskid",
"activityid",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("completed_tasks");
@@ -53,7 +69,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseContentFlagsRepository {
public:
@@ -39,11 +40,26 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"flag_name",
"enabled",
"notes",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("content_flags");
@@ -53,7 +69,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseDamageshieldtypesRepository {
public:
@@ -35,11 +36,24 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"spellid",
"type",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("damageshieldtypes");
@@ -49,7 +63,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseDataBucketsRepository {
public:
@@ -39,11 +40,26 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"key",
"value",
"expires",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("data_buckets");
@@ -53,7 +69,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -110,7 +126,7 @@ public:
if (results.RowCount() == 1) {
DataBuckets entry{};
entry.id = strtoll(row[0], NULL, 10);
entry.id = strtoll(row[0], nullptr, 10);
entry.key = row[1] ? row[1] : "";
entry.value = row[2] ? row[2] : "";
entry.expires = atoi(row[3]);
@@ -241,7 +257,7 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) {
DataBuckets entry{};
entry.id = strtoll(row[0], NULL, 10);
entry.id = strtoll(row[0], nullptr, 10);
entry.key = row[1] ? row[1] : "";
entry.value = row[2] ? row[2] : "";
entry.expires = atoi(row[3]);
@@ -269,7 +285,7 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) {
DataBuckets entry{};
entry.id = strtoll(row[0], NULL, 10);
entry.id = strtoll(row[0], nullptr, 10);
entry.key = row[1] ? row[1] : "";
entry.value = row[2] ? row[2] : "";
entry.expires = atoi(row[3]);
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseDbStrRepository {
public:
@@ -37,11 +38,25 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"type",
"value",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("db_str");
@@ -51,7 +66,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseDiscoveredItemsRepository {
public:
@@ -39,11 +40,26 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"item_id",
"char_name",
"discovered_date",
"account_status",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("discovered_items");
@@ -53,7 +69,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseDoorsRepository {
public:
@@ -101,11 +102,57 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"doorid",
"zone",
"version",
"name",
"pos_y",
"pos_x",
"pos_z",
"heading",
"opentype",
"guild",
"lockpick",
"keyitem",
"nokeyring",
"triggerdoor",
"triggertype",
"disable_timer",
"doorisopen",
"door_param",
"dest_zone",
"dest_instance",
"dest_x",
"dest_y",
"dest_z",
"dest_heading",
"invert_state",
"incline",
"size",
"buffer",
"client_version_mask",
"is_ldon_door",
"min_expansion",
"max_expansion",
"content_flags",
"content_flags_disabled",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("doors");
@@ -115,7 +162,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -164,8 +211,8 @@ public:
entry.buffer = 0;
entry.client_version_mask = 4294967295;
entry.is_ldon_door = 0;
entry.min_expansion = 0;
entry.max_expansion = 0;
entry.min_expansion = -1;
entry.max_expansion = -1;
entry.content_flags = "";
entry.content_flags_disabled = "";
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseDynamicZoneMembersRepository {
public:
@@ -37,11 +38,25 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"dynamic_zone_id",
"character_id",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("dynamic_zone_members");
@@ -51,7 +66,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseDynamicZonesRepository {
public:
@@ -75,11 +76,44 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"instance_id",
"type",
"uuid",
"name",
"leader_id",
"min_players",
"max_players",
"compass_zone_id",
"compass_x",
"compass_y",
"compass_z",
"safe_return_zone_id",
"safe_return_x",
"safe_return_y",
"safe_return_z",
"safe_return_heading",
"zone_in_x",
"zone_in_y",
"zone_in_z",
"zone_in_heading",
"has_zone_in",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("dynamic_zones");
@@ -89,7 +123,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseEventlogRepository {
public:
@@ -51,11 +52,32 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"accountname",
"accountid",
"status",
"charname",
"target",
"time",
"descriptiontype",
"description",
"event_nid",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("eventlog");
@@ -65,7 +87,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -89,7 +111,7 @@ public:
entry.status = 0;
entry.charname = "";
entry.target = "None";
entry.time = "";
entry.time = std::time(nullptr);
entry.descriptiontype = "";
entry.description = "";
entry.event_nid = 0;
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseExpeditionLockoutsRepository {
public:
@@ -21,7 +22,7 @@ public:
int id;
int expedition_id;
std::string event_name;
std::string expire_time;
time_t expire_time;
int duration;
std::string from_expedition_uuid;
};
@@ -43,11 +44,28 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"expedition_id",
"event_name",
"UNIX_TIMESTAMP(expire_time)",
"duration",
"from_expedition_uuid",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("expedition_lockouts");
@@ -57,7 +75,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -78,7 +96,7 @@ public:
entry.id = 0;
entry.expedition_id = 0;
entry.event_name = "";
entry.expire_time = "";
entry.expire_time = std::time(nullptr);
entry.duration = 0;
entry.from_expedition_uuid = "";
@@ -119,7 +137,7 @@ public:
entry.id = atoi(row[0]);
entry.expedition_id = atoi(row[1]);
entry.event_name = row[2] ? row[2] : "";
entry.expire_time = row[3] ? row[3] : "";
entry.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
entry.duration = atoi(row[4]);
entry.from_expedition_uuid = row[5] ? row[5] : "";
@@ -157,7 +175,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(expedition_lockouts_entry.expedition_id));
update_values.push_back(columns[2] + " = '" + EscapeString(expedition_lockouts_entry.event_name) + "'");
update_values.push_back(columns[3] + " = '" + EscapeString(expedition_lockouts_entry.expire_time) + "'");
update_values.push_back(columns[3] + " = FROM_UNIXTIME(" + (expedition_lockouts_entry.expire_time > 0 ? std::to_string(expedition_lockouts_entry.expire_time) : "null") + ")");
update_values.push_back(columns[4] + " = " + std::to_string(expedition_lockouts_entry.duration));
update_values.push_back(columns[5] + " = '" + EscapeString(expedition_lockouts_entry.from_expedition_uuid) + "'");
@@ -184,7 +202,7 @@ public:
insert_values.push_back(std::to_string(expedition_lockouts_entry.id));
insert_values.push_back(std::to_string(expedition_lockouts_entry.expedition_id));
insert_values.push_back("'" + EscapeString(expedition_lockouts_entry.event_name) + "'");
insert_values.push_back("'" + EscapeString(expedition_lockouts_entry.expire_time) + "'");
insert_values.push_back("FROM_UNIXTIME(" + (expedition_lockouts_entry.expire_time > 0 ? std::to_string(expedition_lockouts_entry.expire_time) : "null") + ")");
insert_values.push_back(std::to_string(expedition_lockouts_entry.duration));
insert_values.push_back("'" + EscapeString(expedition_lockouts_entry.from_expedition_uuid) + "'");
@@ -219,7 +237,7 @@ public:
insert_values.push_back(std::to_string(expedition_lockouts_entry.id));
insert_values.push_back(std::to_string(expedition_lockouts_entry.expedition_id));
insert_values.push_back("'" + EscapeString(expedition_lockouts_entry.event_name) + "'");
insert_values.push_back("'" + EscapeString(expedition_lockouts_entry.expire_time) + "'");
insert_values.push_back("FROM_UNIXTIME(" + (expedition_lockouts_entry.expire_time > 0 ? std::to_string(expedition_lockouts_entry.expire_time) : "null") + ")");
insert_values.push_back(std::to_string(expedition_lockouts_entry.duration));
insert_values.push_back("'" + EscapeString(expedition_lockouts_entry.from_expedition_uuid) + "'");
@@ -258,7 +276,7 @@ public:
entry.id = atoi(row[0]);
entry.expedition_id = atoi(row[1]);
entry.event_name = row[2] ? row[2] : "";
entry.expire_time = row[3] ? row[3] : "";
entry.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
entry.duration = atoi(row[4]);
entry.from_expedition_uuid = row[5] ? row[5] : "";
@@ -288,7 +306,7 @@ public:
entry.id = atoi(row[0]);
entry.expedition_id = atoi(row[1]);
entry.event_name = row[2] ? row[2] : "";
entry.expire_time = row[3] ? row[3] : "";
entry.expire_time = strtoll(row[3] ? row[3] : "-1", nullptr, 10);
entry.duration = atoi(row[4]);
entry.from_expedition_uuid = row[5] ? row[5] : "";
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseExpeditionsRepository {
public:
@@ -39,11 +40,26 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"dynamic_zone_id",
"add_replay_on_join",
"is_locked",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("expeditions");
@@ -53,7 +69,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseFactionBaseDataRepository {
public:
@@ -43,11 +44,28 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"client_faction_id",
"min",
"max",
"unk_hero1",
"unk_hero2",
"unk_hero3",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("faction_base_data");
@@ -57,7 +75,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseFactionListModRepository {
public:
@@ -39,11 +40,26 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"faction_id",
"mod",
"mod_name",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("faction_list_mod");
@@ -53,7 +69,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseFactionListRepository {
public:
@@ -37,11 +38,25 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"name",
"base",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("faction_list");
@@ -51,7 +66,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseFactionValuesRepository {
public:
@@ -39,11 +40,26 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"char_id",
"faction_id",
"current_value",
"temp",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("faction_values");
@@ -53,7 +69,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseFishingRepository {
public:
@@ -53,11 +54,33 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"zoneid",
"Itemid",
"skill_level",
"chance",
"npc_id",
"npc_chance",
"min_expansion",
"max_expansion",
"content_flags",
"content_flags_disabled",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("fishing");
@@ -67,7 +90,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -92,8 +115,8 @@ public:
entry.chance = 0;
entry.npc_id = 0;
entry.npc_chance = 0;
entry.min_expansion = 0;
entry.max_expansion = 0;
entry.min_expansion = -1;
entry.max_expansion = -1;
entry.content_flags = "";
entry.content_flags_disabled = "";
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseForageRepository {
public:
@@ -49,11 +50,31 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"zoneid",
"Itemid",
"level",
"chance",
"min_expansion",
"max_expansion",
"content_flags",
"content_flags_disabled",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("forage");
@@ -63,7 +84,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -86,8 +107,8 @@ public:
entry.Itemid = 0;
entry.level = 0;
entry.chance = 0;
entry.min_expansion = 0;
entry.max_expansion = 0;
entry.min_expansion = -1;
entry.max_expansion = -1;
entry.content_flags = "";
entry.content_flags_disabled = "";
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseFriendsRepository {
public:
@@ -37,11 +38,25 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"charid",
"type",
"name",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("friends");
@@ -51,7 +66,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseGlobalLootRepository {
public:
@@ -65,11 +66,39 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"description",
"loottable_id",
"enabled",
"min_level",
"max_level",
"rare",
"raid",
"race",
"`class`",
"bodytype",
"zone",
"hot_zone",
"min_expansion",
"max_expansion",
"content_flags",
"content_flags_disabled",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("global_loot");
@@ -79,7 +108,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -110,8 +139,8 @@ public:
entry.bodytype = "";
entry.zone = "";
entry.hot_zone = 0;
entry.min_expansion = 0;
entry.max_expansion = 0;
entry.min_expansion = -1;
entry.max_expansion = -1;
entry.content_flags = "";
entry.content_flags_disabled = "";
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseGmIpsRepository {
public:
@@ -37,11 +38,25 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"name",
"account_id",
"ip_address",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("gm_ips");
@@ -51,7 +66,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseGoallistsRepository {
public:
@@ -35,11 +36,24 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"listid",
"entry",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("goallists");
@@ -49,7 +63,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseGraveyardRepository {
public:
@@ -43,11 +44,28 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"zone_id",
"x",
"y",
"z",
"heading",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("graveyard");
@@ -57,7 +75,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseGroundSpawnsRepository {
public:
@@ -67,11 +68,40 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"zoneid",
"version",
"max_x",
"max_y",
"max_z",
"min_x",
"min_y",
"heading",
"name",
"item",
"max_allowed",
"comment",
"respawn_timer",
"min_expansion",
"max_expansion",
"content_flags",
"content_flags_disabled",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("ground_spawns");
@@ -81,7 +111,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -113,8 +143,8 @@ public:
entry.max_allowed = 1;
entry.comment = "";
entry.respawn_timer = 300;
entry.min_expansion = 0;
entry.max_expansion = 0;
entry.min_expansion = -1;
entry.max_expansion = -1;
entry.content_flags = "";
entry.content_flags_disabled = "";
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseGroupIdRepository {
public:
@@ -39,11 +40,26 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"groupid",
"charid",
"name",
"ismerc",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("group_id");
@@ -53,7 +69,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseGroupLeadersRepository {
public:
@@ -49,11 +50,31 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"gid",
"leadername",
"marknpc",
"leadershipaa",
"maintank",
"assist",
"puller",
"mentoree",
"mentor_percent",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("group_leaders");
@@ -63,7 +84,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseGuildMembersRepository {
public:
@@ -49,11 +50,31 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"char_id",
"guild_id",
"rank",
"tribute_enable",
"total_tribute",
"last_tribute",
"banker",
"public_note",
"alt",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("guild_members");
@@ -63,7 +84,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseGuildRanksRepository {
public:
@@ -53,11 +54,33 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"guild_id",
"rank",
"title",
"can_hear",
"can_speak",
"can_invite",
"can_remove",
"can_promote",
"can_demote",
"can_motd",
"can_warpeace",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("guild_ranks");
@@ -67,7 +90,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseGuildRelationsRepository {
public:
@@ -37,11 +38,25 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"guild1",
"guild2",
"relation",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("guild_relations");
@@ -51,7 +66,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseGuildsRepository {
public:
@@ -49,11 +50,31 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"name",
"leader",
"minstatus",
"motd",
"tribute",
"motd_setter",
"channel",
"url",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("guilds");
@@ -63,7 +84,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseHackersRepository {
public:
@@ -43,11 +44,28 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"account",
"name",
"hacked",
"zone",
"date",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("hackers");
@@ -57,7 +75,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -80,7 +98,7 @@ public:
entry.name = "";
entry.hacked = "";
entry.zone = "";
entry.date = "";
entry.date = std::time(nullptr);
return entry;
}
@@ -1,29 +1,12 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
* DO NOT MODIFY THIS FILE
*
* 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
*
*
*/
/**
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to
* the repository extending the base. Any modifications to base repositories are to
* be made by the generator only
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://eqemu.gitbook.io/server/in-development/developer-area/repositories
*/
#ifndef EQEMU_BASE_HORSES_REPOSITORY_H
@@ -31,26 +14,42 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseHorsesRepository {
public:
struct Horses {
int id;
std::string filename;
int16 race;
int8 gender;
int8 texture;
int race;
int gender;
int texture;
float mountspeed;
std::string notes;
};
static std::string PrimaryKey()
{
return std::string("filename");
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"filename",
"race",
"gender",
"texture",
"mountspeed",
"notes",
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"filename",
"race",
"gender",
@@ -65,19 +64,9 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
static std::string SelectColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
@@ -89,7 +78,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}
@@ -99,7 +88,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -107,6 +96,7 @@ public:
{
Horses entry{};
entry.id = 0;
entry.filename = "";
entry.race = 216;
entry.gender = 0;
@@ -123,7 +113,7 @@ public:
)
{
for (auto &horses : horsess) {
if (horses.filename == horses_id) {
if (horses.id == horses_id) {
return horses;
}
}
@@ -132,10 +122,11 @@ public:
}
static Horses FindOne(
Database& db,
int horses_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -147,12 +138,13 @@ public:
if (results.RowCount() == 1) {
Horses entry{};
entry.filename = row[0] ? row[0] : "";
entry.race = atoi(row[1]);
entry.gender = atoi(row[2]);
entry.texture = atoi(row[3]);
entry.mountspeed = atof(row[4]);
entry.notes = row[5] ? row[5] : "";
entry.id = atoi(row[0]);
entry.filename = row[1] ? row[1] : "";
entry.race = atoi(row[2]);
entry.gender = atoi(row[3]);
entry.texture = atoi(row[4]);
entry.mountspeed = static_cast<float>(atof(row[5]));
entry.notes = row[6] ? row[6] : "";
return entry;
}
@@ -161,10 +153,11 @@ public:
}
static int DeleteOne(
Database& db,
int horses_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -177,6 +170,7 @@ public:
}
static int UpdateOne(
Database& db,
Horses horses_entry
)
{
@@ -184,20 +178,20 @@ public:
auto columns = Columns();
update_values.push_back(columns[0] + " = '" + EscapeString(horses_entry.filename) + "'");
update_values.push_back(columns[1] + " = " + std::to_string(horses_entry.race));
update_values.push_back(columns[2] + " = " + std::to_string(horses_entry.gender));
update_values.push_back(columns[3] + " = " + std::to_string(horses_entry.texture));
update_values.push_back(columns[4] + " = " + std::to_string(horses_entry.mountspeed));
update_values.push_back(columns[5] + " = '" + EscapeString(horses_entry.notes) + "'");
update_values.push_back(columns[1] + " = '" + EscapeString(horses_entry.filename) + "'");
update_values.push_back(columns[2] + " = " + std::to_string(horses_entry.race));
update_values.push_back(columns[3] + " = " + std::to_string(horses_entry.gender));
update_values.push_back(columns[4] + " = " + std::to_string(horses_entry.texture));
update_values.push_back(columns[5] + " = " + std::to_string(horses_entry.mountspeed));
update_values.push_back(columns[6] + " = '" + EscapeString(horses_entry.notes) + "'");
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
horses_entry.filename
horses_entry.id
)
);
@@ -205,11 +199,13 @@ public:
}
static Horses InsertOne(
Database& db,
Horses horses_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(horses_entry.id));
insert_values.push_back("'" + EscapeString(horses_entry.filename) + "'");
insert_values.push_back(std::to_string(horses_entry.race));
insert_values.push_back(std::to_string(horses_entry.gender));
@@ -217,7 +213,7 @@ public:
insert_values.push_back(std::to_string(horses_entry.mountspeed));
insert_values.push_back("'" + EscapeString(horses_entry.notes) + "'");
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -226,7 +222,7 @@ public:
);
if (results.Success()) {
horses_entry.filename = results.LastInsertedID();
horses_entry.id = results.LastInsertedID();
return horses_entry;
}
@@ -236,6 +232,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<Horses> horses_entries
)
{
@@ -244,6 +241,7 @@ public:
for (auto &horses_entry: horses_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(horses_entry.id));
insert_values.push_back("'" + EscapeString(horses_entry.filename) + "'");
insert_values.push_back(std::to_string(horses_entry.race));
insert_values.push_back(std::to_string(horses_entry.gender));
@@ -256,7 +254,7 @@ public:
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -267,11 +265,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<Horses> All()
static std::vector<Horses> All(Database& db)
{
std::vector<Horses> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -283,12 +281,13 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) {
Horses entry{};
entry.filename = row[0] ? row[0] : "";
entry.race = atoi(row[1]);
entry.gender = atoi(row[2]);
entry.texture = atoi(row[3]);
entry.mountspeed = atof(row[4]);
entry.notes = row[5] ? row[5] : "";
entry.id = atoi(row[0]);
entry.filename = row[1] ? row[1] : "";
entry.race = atoi(row[2]);
entry.gender = atoi(row[3]);
entry.texture = atoi(row[4]);
entry.mountspeed = static_cast<float>(atof(row[5]));
entry.notes = row[6] ? row[6] : "";
all_entries.push_back(entry);
}
@@ -296,11 +295,11 @@ public:
return all_entries;
}
static std::vector<Horses> GetWhere(std::string where_filter)
static std::vector<Horses> GetWhere(Database& db, std::string where_filter)
{
std::vector<Horses> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -313,12 +312,13 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) {
Horses entry{};
entry.filename = row[0] ? row[0] : "";
entry.race = atoi(row[1]);
entry.gender = atoi(row[2]);
entry.texture = atoi(row[3]);
entry.mountspeed = atof(row[4]);
entry.notes = row[5] ? row[5] : "";
entry.id = atoi(row[0]);
entry.filename = row[1] ? row[1] : "";
entry.race = atoi(row[2]);
entry.gender = atoi(row[3]);
entry.texture = atoi(row[4]);
entry.mountspeed = static_cast<float>(atof(row[5]));
entry.notes = row[6] ? row[6] : "";
all_entries.push_back(entry);
}
@@ -326,13 +326,12 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
PrimaryKey(),
where_filter
)
);
@@ -340,6 +339,18 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate(Database& db)
{
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_HORSES_REPOSITORY_H
@@ -14,6 +14,7 @@
#include "../../database.h"
#include "../../string_util.h"
#include <ctime>
class BaseInstanceListPlayerRepository {
public:
@@ -35,11 +36,24 @@ public:
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"charid",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("instance_list_player");
@@ -49,7 +63,7 @@ public:
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
SelectColumnsRaw(),
TableName()
);
}

Some files were not shown because too many files have changed in this diff Show More