Compare commits

...

265 Commits

Author SHA1 Message Date
fryguy b7eeb3b2f9 [LDoN] Update methods for removing wins/losses 2021-06-02 08:51:24 -04:00
Kinglykrab d2f8eead1f Add LDoN remove methods for losses and wins. 2021-06-01 20:57:03 -04:00
RoTPvP 71e9dd5a3c [PVP] Pvp guard assist code. (Guards will assist in PvP based on faction) (#1367)
* Added Guard Assist Code

* Added PvP Rule and Detrimental Spell Check

* Added IsGuard() Method

* Change from uint to bool

* Added a faction check to IsGuard()

* Simplified Guard Checks, reduced costs

* Added IsNPC check to guard check

* simplified pet check

* Removed Magic numbers

* Formatting Fix

* Code fixes

* Fixed constants

Co-authored-by: ProducerZekServer <go@away.com>
2021-05-30 20:22:52 -05:00
Dencelle 542ec38660 [Bug Fix] Fix for charges not being sold correctly (#1357)
* fix for charges not being sold correctly

https://github.com/EQEmu/Server/issues/1350 this fixes this issue

* Update client_packet.cpp

* Update zone.cpp

this completes the fix for all charge items being sold to merchants

* code opmizations

could probably be fixed up better but this is a little cleaner

* Update snake_casing

Co-authored-by: Chris Miles <akkadius1@gmail.com>
2021-05-24 21:16:46 -05:00
Alex e14acd6802 [Quest API] Add several methods to Perl/Lua API for LDoN stuff. (#1356)
- Swapped parameters in mostly unused functions to be theme_id first and points second. (No examples in PEQ quests.)
- Add $client->AddLDoNLoss(theme_id) to Perl.
- Add $client->AddLDoNWin(theme_id) to Perl.
- Add quest::crosszoneaddldonlossbycharid(character_id, theme_id) to Perl.
- Add quest::crosszoneaddldonlossbygroupid(group_id, theme_id) to Perl.
- Add quest::crosszoneaddldonlossbyraidid(raid_id, theme_id) to Perl.
- Add quest::crosszoneaddldonlossbyguildid(guild_id, theme_id) to Perl.
- Add quest::crosszoneaddldonlossbyexpeditionid(expedition_id, theme_id) to Perl.
- Add quest::crosszoneaddldonpointsbycharid(character_id, theme_id, points) to Perl.
- Add quest::crosszoneaddldonpointsbygroupid(group_id, theme_id, points) to Perl.
- Add quest::crosszoneaddldonpointsbyraidid(raid_id, theme_id, points) to Perl.
- Add quest::crosszoneaddldonpointsbyguildid(guild_id, theme_id, points) to Perl.
- Add quest::crosszoneaddldonpointsbyexpeditionid(expedition_id, theme_id, points) to Perl.
- Add quest::crosszoneaddldonwinbycharid(character_id, theme_id) to Perl.
- Add quest::crosszoneaddldonwinbygroupid(group_id, theme_id) to Perl.
- Add quest::crosszoneaddldonwinbyraidid(raid_id, theme_id) to Perl.
- Add quest::crosszoneaddldonwinbyguildid(guild_id, theme_id) to Perl.
- Add quest::crosszoneaddldonwinbyexpeditionid(expedition_id, theme_id) to Perl.
- Fix quest::addldonloss(theme_id) in Perl.
- Fix quest::addldonwin(theme_id) in Perl.
- Add client:AddLDoNLoss(theme_id) to Lua.
- Add client:AddLDoNWin(theme_id) to Lua.
- Add eq.add_ldon_loss(theme_id) to Lua.
- Add eq.add_ldon_points(theme_id, points) to Lua.
- Add eq.add_ldon_win(theme_id) to Lua.
- Add eq.cross_zone_add_ldon_loss_by_char_id(character_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_loss_by_group_id(group_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_loss_by_raid_id(raid_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_loss_by_guild_id(guild_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_loss_by_expedition_id(expedition_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_points_by_char_id(character_id, theme_id, points) to Lua.
- Add eq.cross_zone_add_ldon_points_by_group_id(group_id, theme_id, points) to Lua.
- Add eq.cross_zone_add_ldon_points_by_raid_id(raid_id, theme_id, points) to Lua.
- Add eq.cross_zone_add_ldon_points_by_guild_id(guild_id, theme_id, points) to Lua.
- Add eq.cross_zone_add_ldon_points_by_expedition_id(expedition_id, theme_id, points) to Lua.
- Add eq.cross_zone_add_ldon_win_by_char_id(character_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_win_by_group_id(group_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_win_by_raid_id(raid_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_win_by_guild_id(guild_id, theme_id) to Lua.
- Add eq.cross_zone_add_ldon_win_by_expedition_id(expedition_id, theme_id) to Lua.
2021-05-24 21:15:41 -05:00
hg 15328196e2 [Expeditions] Store members on dynamic zone (#1358)
This moves members from expeditions so other systems can use them

Replace expedition_members table with dynamic_zone_members

Move 'EnableInDynamicZoneStatus' rule to DynamicZone namespace

Modify #dz list to show dz members (not instance players) and type name

Move various queries to repository methods
2021-05-24 21:14:32 -05:00
splose e8b94a11f1 [Rules] Add rule to allow you to cast invis on already invis'd players (#1361) 2021-05-24 20:29:27 -05:00
TurmoilToad 7458b5f32f [Docs] Create CODE_OF_CONDUCT.md (#1360) 2021-05-24 20:23:50 -05:00
hg efa245d636 [Quest API] Add write overloads to lua packet quest api (#1366)
Makes prototyping easier without having to manually track an offset

Also add GetWritePosition and SetWritePosition
2021-05-24 20:22:31 -05:00
Michael Cook (mackal) e5b9d72b81 [Fix] Fix Spell Cast Time reduction issues (#1369)
Remove the overloads that don't make sense (bots probably doesn't make
sense either, but too lazy)

Fix the formulas

Removed the Spells:MaxCastTimeReduction rule since this is HARDCODED in
the client so it doesn't really make sense to have it as a customization
point. If you want to hack the client, change the hardcode as well I
guess.
2021-05-24 20:21:39 -05:00
Alex 93329b4b06 [Shared Bank] Add additional popup to shared bank warning message, as client-side filters can cause the message to be unseen. (#1368) 2021-05-24 20:15:37 -05:00
Michael Cook (mackal) b65cf4c081 This skill bonus was suppose to only apply to monks with epics (#1364)
This also scales up to 280 skill, so under that, you don't get as high
of a bonus
2021-05-19 19:40:51 -04:00
Dencelle a59ffc6e6b [Bug Fix] EntityList::AESpell fix for Pacify / Mez (#1354)
* [Bug Fix] EntityList::AESpell fix for Pacify / Mez

this fixes AE pacify / Mez spells only landing on 4 when it shouldn't have a cap

* Update effects.cpp

added constants

* Update effects.cpp

opmization thanks to @mackal

* Update effects.cpp

this fixes the unlimited issue

* added Spells:AOEMaxTargets to rules

incase a server doesn't want there to be a absolute unlimited AOE targeting for spells

* Update ruletypes.h
2021-05-15 17:33:45 -04:00
hg c1c2d7b302 [Dynamic Zones] Store min and max players on dz (#1355)
This starts some changes that move storage of things from expeditions to
dynamic zone class so other systems can possibly use them. This will also
make it easier to move window packet creation methods to DynamicZone.

For now these will remain on the expeditions table in the database. This
can be re-evaluated once other components are moved and seeing how other
systems may want to handle their player requirements.
2021-05-12 19:59:48 -05:00
Paul Coene 4cc24dea75 [GM Command] #list npcs Goto option now goes to higher Z if selected NPC is a boat. (#1349)
* #list npcs Goto option now goes to higher Z if npc selected is a boat.

Makes using #list npcs and using the goto button more useful when NPC is a boat, as normal Z will put you in the water.

* Use ?: instead of bool multiply

* Update command.cpp
2021-05-12 19:17:55 -05:00
hg 1f896d05ed [Repository Generator] Fix repository generator on windows (#1353)
Remove hardcoded port
2021-05-12 19:16:29 -05:00
Michael Cook (mackal) 1f978ffd72 [Bug Fix] EntityList::AESpell was off by one (#1351)
We need to do the spell effect first, then check the limits
2021-05-12 19:13:05 -05:00
JJ 6ce273baf5 [SQL] Tweak SQL from #1339 [skip ci] (#1348) 2021-05-10 11:13:58 -05:00
Alex e18b332414 [CLE] Reset iterator in IsAccountInGame() (#1345) 2021-05-10 01:34:40 -05:00
Paul Coene 2edda6e743 [Feature] Allow any spawn2 spawned mob to path while zone is idle if new flag is set. (#1339)
* Changes to allow any spawn2 to be marked to path even when zone is idle

* Fixed for Kingly review of PR

Co-authored-by: Noudess <noudess@gmail.com>
2021-05-10 01:21:43 -05:00
Paul Coene b335568bf9 Prevent client update while on boat if boat turning (#1343)
Co-authored-by: Noudess <noudess@gmail.com>
2021-05-10 01:15:38 -05:00
JeffyW 0758250ad1 [Installer] $ENV support, formatting, and optimizations (#1340)
* [Installer] $ENV support

Add support for passing in installation variables instead of install_variables.txt.

In particular:
- EQEMU_SERVER_SKIP_UPDATE
- EQEMU_SERVER_SKIP_MAPS_UPDATE
Both work the same as files with the same name.

- MYSQL_DATABASE
- MYSQL_USER
- MYSQL_PASSWORD
All get read into the same $installation_variables collection, and are still overridden by any values found in installation_variables.txt

- MYSQL_HOST
Added to the list of $installation_variables, supported in installation_variables.txt, and overrides the default host for where the database lives (allowing it to be a separate container)

- MYSQL_ROOT_PASSWORD
If set, will use "root" as the user for DROP/CREATE DATABASE calls, to prevent requiring the "eq" user requiring more permission than is given by default with the MySql/MariaDB containers.

* [Installer] new_server_with_bots

Enabling bots requires both updated binaries and some database scripts.  Fetching source and compiling the code is the longest part of setting up a new server.  If you know you want bots, rather than having to do it twice, we can just accept an option to do it all at the same time.

* [Installer] Git/Source/Build optimizations

Source code is the same for bot/non-bot, so switch to a common directory for source and separate directories for build.

If the source directory already exists with a .git subfolder, rather than attempt to re-clone, instead do a git pull to still get the latest code.  Helps when using a shared volume but rebuilding containers.

* [Installer] Formatting / Cleanup

Fixed some indentation, added an existing option to the utility script output, removed some excess newlines, and moved a debug output to help identifying errors.
2021-05-10 01:15:11 -05:00
Paul Coene 843aac631b [Bug Fix] Add debugging and fix edge case where no target for aggro mob (#1344)
Co-authored-by: Noudess <noudess@gmail.com>
2021-05-10 01:10:13 -05:00
hg 0ce7c11d36 [Expeditions] Track DZ member status in world (#1341)
World now caches and tracks member statuses so it can send them to zones
that request them on startup. Prior to this the cle would be searched in
world for every zone startup caching request, now it's only searched once
when a new expedition is created.

Bulk loading statuses removed since it would only be needed on world
startup now and likely have no clients in the client list anyway.

This also lets world choose non-linkdead members on expedition leader
changes and better detect when a leader change needs to occur
2021-05-10 01:07:19 -05:00
Alex 26d374d52a [Quest API] Add IsRaidTarget() to Perl and Lua (#1347)
- Add $npc->IsRaidTarget() to Perl.
- Add npc:IsRaidTarget() to Lua.
2021-05-10 01:05:46 -05:00
Paul Coene 39f5949441 #grid delete was deleting the grids everywhere (#1346)
Fix to only delete correct zone grid.
2021-05-09 16:39:54 -04:00
hg abf73947f4 [Dynamic Zones] Rename dynamic zone structs (#1327)
* Rename dz member id field

The name of the struct is enough to make this implicit

* Rename dz member enum and struct

Rename ExpeditionMember to DynamicZoneMember

Rename ExpeditionMemberStatus to DynamicZoneMemberStatus

* Rename dz window packet structs

This makes it more clear the window may be used by any dynamic zone
system not just expeditions (live missions fill the window when
player doesn't have an active expedition).

* Rename dz window packet fields
2021-04-27 18:53:56 -05:00
Michael Cook (mackal) 4358e24dab [Bug Fix] Fix use-after-free corruption with some DB calls (#1335) 2021-04-27 18:53:34 -05:00
Michael Cook (mackal) c063d9512e [Rule] Add a rule to disable the Pet Resist buff (#1337)
Spells:July242002PetResists defaults to true
2021-04-27 18:52:39 -05:00
Alex 39de9c04f6 Add new experience modifiers table to GetCharacterTables() and GetPlayerTables() in database_schema.h. (#1338) 2021-04-27 18:52:00 -05:00
Alex 1637ea95cb Fix Perl NPC GetAvoidanceRating() Perl Croak. (#1333) 2021-04-27 17:46:59 -04:00
Paul Coene 6fb687871c Fix calls to GetSafePoints to not pass null_ptr as zonename (#1336)
* Fix calls to GetSafePoints to not pass null_ptr as zonename

* Fix GetSafePoints to check and deal will nullptr being sent as short_zone_name

* Remove unintentinal formatting change

* Fix some typos/cut-n-paste errors I assume

Co-authored-by: Noudess <noudess@gmail.com>
2021-04-27 17:21:37 -04:00
Alex dd06033a58 Add character-specific zone-based experience modifiers. (#1326)
* Add character-specific zone-based experience modifiers.

This will allow server operators to give players individual experience modifiers (regular and AA).

Zone ID 0 will server as a global modifier for players, if no rows are found the modifier defaults to 1.0 so experience is neither increased nor decreased.

Setting a zone-specific modifier will override the zone ID 0 global modifier.

Requires a SQL update: sql/git/required/2021_04_11_character_exp_modifiers.sql

- Add quest::getaaexpmodifierbycharid(character_id, zone_id) to Perl.
- Add eq.get_aa_exp_modifier_by_char_id(character_id, zone_id) to Lua.
- Add quest::getexpmodifierbycharid(character_id, zone_id) to Perl.
- Add eq.get_exp_modifier_by_char_id(character_id, zone_id) to Lua.
- Add quest::setaaexpmodifierbycharid(character_id, zone_id, aa_modifier) to Perl.
- Add eq.set_aa_exp_modifier_by_char_id(character_id, zone_id, aa_modifier) to Lua.
- Add quest::setexpmodifierbycharid(character_id, zone_id, exp_modifier) to Perl.
- Add eq.set_exp_modifier_by_char_id(character_id, zone_id, exp_modifier) to Lua.
- Add $client->GetAAEXPModifier(character_id, zone_id) to Perl.
- Add client:GetAAEXPModifier(character_id, zone_id) to Lua.
- Add $client->GetEXPModifier(character_id, zone_id) to Perl.
- Add client:GetEXPModifier(character_id, zone_id) to Lua.
- Add $client->SetAAEXPModifier(zone_id, aa_modifier) to Perl.
- Add client:SetAAEXPModifier(zone_id, aa_modifier) to Lua.
- Add $client->SetEXPModifier(zone_id, exp_modifier) to Perl.
- Add client:SetEXPModifier(zone_id, exp_modifier) to Lua.

* Removed unneeded [].

* Fix variable name,

* Fix variable name.

* Fix version.h.

* Rename 2021_04_11_character_exp_modifiers.sql to 2021_04_23_character_exp_modifiers.sql

* Update db_update_manifest.txt
2021-04-23 08:47:39 -04:00
Alex 13a50f7806 [Quest API] Add HTML color tag method to Perl and Lua. (#1324)
* Add HTML color tag method to Perl and Lua.
- Add quest::gethexcolorcode(color_name) to Perl.
- Add eq.get_hex_color_code(color_name) to Lua.

Full color list here: https://pastebin.com/rUYKr1ye

* Convert to static and use strcasecmp over strcmp.

Co-authored-by: Chris Miles <akkadius1@gmail.com>
2021-04-22 23:52:00 -05:00
Paul Coene c18562b150 [Bug] Fix ignore_primary_assist. (#1323)
* [Bug] Fix ignore_primary_assist.

* Fix to continue loop instead of return

Co-authored-by: Noudess <noudess@gmail.com>
2021-04-22 23:40:17 -05:00
Michael Cook (mackal) dba3010c89 [Strings] Split String Optimizations (#1325)
* Switch the 2 split calls to SplitString

* Nuke duplicate split in favor of SplitString #1263

* Add a test for SplitString

* Optimize SplitString

Benchmarking:
--------------------------------------------------------------
Benchmark                       Time           CPU Iterations
--------------------------------------------------------------
bench_oldsplit               5201 ns       5201 ns     129500
bench_split                  1269 ns       1269 ns     548906

This is splitting a VERY long SpecialAbilities string. This is ~75%
speed up.
2021-04-22 23:36:39 -05:00
Alex 00fb9bc9f9 [Bug Fix] Zone Heading for Binds, Summons, Teleports, and Zoning. (#1328)
* For as long as I can remember people have had issues with zoning in, facing the wrong way, and walking through a zone line.

With this we will be able to set zone's safe heading as well as preserve heading on summon (NPC or GM) and teleports between zones.

This affects several pre-existing quest methods and extends their parameters to allow for the addition of heading.

The following functions have had heading added.
Lua
- client:SetBindPoint()
- client:SetStartZone()

Perl
- $client->SetBindPoint()
- $client->SetStartZone()
- quest::rebind()

SetStartZone parameter list was fixed also.

This converts some pre-existing methods from glm::vec3() to glm::vec4() and has an overload where necessary to use a glm::vec3() method versus glm::vec4() method.

This shouldn't affect any pre-existing servers and will allow PEQ and others to document safe headings for zones properly.

* Removed possible memory leaks.

* Fix SQL.

* Fix client message.

* Fix debug log.

* Fix log message.

* Fix call in rebind overload.

* Fix floats.

* Add default to column.
2021-04-22 22:49:44 -05:00
splose 5893730704 [Rules] Add rule 'GM:MinStatusToBypassLockedServer' (#1330)
* Add rule 'GM:MinStatusToBypassLockedServer'
Default Status: 100
Description: Players >= this status can log in to the server even when it is locked

* Add rule 'GM:MinStatusToBypassLockedServer'
Default Status: 100
Description: Players >= this status can log in to the server even when it is locked
2021-04-22 22:42:14 -05:00
Alex 0f23bd24cc [Quest API] Convert Client GetLastName() method export to Mob export. (#1331) 2021-04-22 22:41:19 -05:00
Peter Rigby 324d48aa90 [Fix] Moved assigning of AISpellVar variables before AI_Start() so that any values that override the rule values will not be ignored (#1321) 2021-04-07 01:22:42 -05:00
hg dadc1b2843 [Expeditions] Refactor expedition caching (#1315)
Add common expedition base class

Use repository for zone and world expedition caching

World now stores members and leader as Member objects instead of ids

This improves readability of the caching methods and lets world cache
expedition dzs and members like zone. World also now caches expeditions
as unique_ptr which will be necessary for future dz callback lambdas
that capture 'this' so addresses don't change on cache vector resizes.
2021-04-07 01:20:35 -05:00
Michael Cook (mackal) 0534a2c6be Switch scheduled hot zone check to search instead of split (#1313)
Using search_deliminated_string here is significantly faster than
splitting, most likely because of dynamic memory management

Some tests on my system:

----------------------------------------------------
Benchmark             Time           CPU Iterations
----------------------------------------------------
bench_split         864 ns        864 ns     807922
bench_search         35 ns         35 ns   20265205

This test was a case where the string was present somewhere in the
middle which gave a ~96% speed up

----------------------------------------------------
Benchmark             Time           CPU Iterations
----------------------------------------------------
bench_split         936 ns        936 ns     725518
bench_search         61 ns         61 ns   11156359

This test was when the string was not present, which will be the vast
majority of times this is actually checked, was ~93% speed up
2021-04-07 01:17:30 -05:00
RoTPvP 050e78b1b6 Added a check to stop Bard song for Mezz/Stun (#1319)
* Added a check to stop Bard song for Mezz/Stun

* Cleaned Song stun / mezz stop

* Update client_process.cpp

* removed bard check & added else where

* code clean up

Co-authored-by: ProducerZekServer <go@away.com>
2021-04-02 23:44:59 -04:00
Michael Cook (mackal) 084b253ff7 Hack to fix repulsable bard charms (#1320)
This isn't the exactly the right way, but it's behavior is much closer
to live than current for Solon's Song of the Sirens (725), the other
bard charms don't repulse due to mana cost
2021-04-01 14:19:47 -04:00
Michael Cook (mackal) a9a83a2052 [Bug Fix] Misc Bard Song Fixes (#1317)
* Bards song with a mana cost shouldn't repulse

* Bard songs with SE_TemporaryPets shouldn't repulse

This is mostly just an issue with Vet AAs, the actually songs have a
recast, so are already handled

* SE_Familiar should be prevented as well
2021-04-01 14:19:29 -04:00
Akkadius d117ce0bf2 [Hotfix] Incorrect Perl usage method (docs) 2021-03-31 00:18:43 -05:00
hg 10b1f7e1ca Add missing includes to fix windows compile (#1314) 2021-03-29 18:09:36 -05:00
Akkadius 4ac32d89e8 [Hotfix] DB Manifest 2021-03-29 03:01:07 -05:00
Chris Miles 7aa5308f9c [Scheduler] Event scheduler implementation (#1257)
* Event scheduler implementation

* Create 2021_02_17_server_scheduled_events.sql

* Tweak

* Remove unused event [skip ci]

* Cleanup [skip ci]

* PR adjustments

* Database manifest
2021-03-29 02:52:57 -05:00
Michael Cook (mackal) f51bc4daaf [Fix] Clean up Filtered/MessageString functions (#1311)
This solves the OOB issue pointed out in #1304 and cleans up the code a
bit so it should be less error prone
2021-03-29 02:18:03 -05:00
hg 049fe55c7f [Expeditions] Create common dz abstract class (#1312)
This creates an abstract class in common so zone and world can share
most of the implementation. World now has access to the same dz data and
api as zone.

Rename CharacterChange to AddRemoveCharacter for clarity

Rename GetRemainingDuration to GetDurationRemaining for consistency

Move dynamic zone queries to custom repository methods
2021-03-29 02:17:36 -05:00
hg f5cf566fca [Expeditions] Let dz process its expired state (#1310)
Move early empty shutdown and process rate rules to DynamicZone scope

This decouples the expired status check from expeditions into an
internal dz method that can be called by its owning system
2021-03-28 20:43:09 -05:00
Alex 97c11a1199 [Quest API] Add new zone name methods to Perl and Lua. (#1309)
- Add quest::GetZoneShortName(zone_id) to Perl.
- Add quest::GetZoneLongNameByID(zone_id) to Perl.
- Add eq.get_zone_id_by_name(zone_name) to Lua.
- Add eq.get_zone_short_name_by_id(zone_id) to Lua.
- Add eq.get_zone_long_name_by_id(zone_id) to Lua.
- Add eq.get_zone_long_name_by_name(zone_name) to Lua.
2021-03-28 20:25:50 -05:00
Akkadius ba64d6f494 [Installer] Swap unstable powershell download for Perl LWP::Simple call 2021-03-28 20:04:34 -05:00
Alex 410ba4b19a [Rules] Cleanup all unused rules. (#1308) 2021-03-28 18:37:21 -05:00
Paul Coene 74076078bb [Boats] Fix x/y offsets from client to reflect EQ x/y instead of boat heading… (#1296)
* Fix x/y offsets from client to reflect EQ x/y instead of boat heading x/y

* Use std version of math calls and reduce the # of calls

* Remove errant instrumentation

Co-authored-by: Noudess <noudess@gmail.com>
2021-03-28 18:20:02 -05:00
hg d9e23a0303 [Expeditions] Decouple dz updates from expeditions (#1303)
Use internal dz messages to process duration and location changes

Add world DynamicZone class (later this will inherit from a base)

Add FindDynamicZoneByID to get dz from zone and world system caches
2021-03-28 18:14:36 -05:00
Thalix dbb9c1d4f4 Minor ruletypes.h cleanup (#1306)
Minor ruletypes.h cleanup
2021-03-28 18:06:56 -05:00
Michael Cook (mackal) d202695e88 [Cleanup] Only link Lua with zone (#1288)
Only zone requires to be linked to lua, so let's not link EVERYTHING.

There is probably more clean up we could do, but I know for a fact Lua
is only used by zone.

This probably has some measurable benefits that probably don't really
matter that much :)
2021-03-19 00:12:46 -05:00
Michael Cook (mackal) 323f5ea92e [Bug Fix] Add Bounds Checking to OP_LFGCommand Comment Processing
Theoretically this could be used to corrupt memory, but they would have
to get extremely lucky to actually execute a successful attack
2021-03-18 23:43:13 -05:00
hg 5b74f1e756 [Expeditions] Refactor expedition requests (#1301)
Move ExpeditionLockoutTimer to common

This simplifies expedition request conflict checks and uses repository
for the queries instead of processing the query result directly.
2021-03-18 23:42:41 -05:00
hg ee4af65268 [Expeditions] Cleanup client dz safe return methods (#1300)
This changes Zone::GetDynamicZone to return a pointer instead of a copy
and also lets DynamicZone be forward declared in zone.h
2021-03-18 23:42:20 -05:00
hg 739b975cad [Expeditions] [Quest API] Add expedition IsLocked to Quest API (#1292) 2021-03-16 00:04:08 -05:00
Thalix 5035451af7 [Crash] Bugfix for zone crash caused by #flymode -1 (#1291)
* Update command.cpp

Fixed typo in the command description.

* Bugfix for #flymode zone crash

Bugfix for #flymode zone crash when invalid values are passed. Also, when entering #flymode without parameters, the correct syntax is now displayed.

* Changed as requested
2021-03-16 00:03:35 -05:00
hg 18a3ff5f12 Throttle auto expedition leader changes (#1293)
This fixes unnecessary leader processing on mass dzquits

Also marks leader dirty for empty expeditions in case something goes
wrong (shouldn't be possible after 62e480fe)
2021-03-16 00:01:48 -05:00
hg 0d12bf0b1f [Expeditions] Store description and leader name on dz (#1294)
* Rename dynamic zone source files

* Store description and leader name on dz

Removes the DynamicZoneInfo struct used for switch list window. This
data can be stored on DynamicZone and kept updated by its owning system

* Separate create compass packet method

Cleanup MarkSingleCompassLoc
2021-03-16 00:00:55 -05:00
splose b3fbe1b015 add quest::get_spell_level(uint16 spell_id, uint8 class_id) (#1295) 2021-03-15 23:59:09 -05:00
splose e9cd0b15a2 setting spawn2.version to -1 will now properly spawn mobs in all zone versions (#1299) 2021-03-15 23:57:54 -05:00
Alex cd08c96fa4 [Quest API] Add secondstotime(duration) to Perl and Lua. (#1281)
- Add quest::converttime(duration) to Perl.
- Add eq.convert_time(duration) to Lua.
2021-03-11 21:38:47 -05:00
Paul Coene ac4a993259 Remove unneeded calls to DoAnim() for spells/bardsong (#1290)
* Removed DoAnim() call from spells and bard song.  Tested on rof2 and titanium

Co-authored-by: Noudess <noudess@gmail.com>
2021-03-10 00:07:30 -05:00
Thalix 435bac5599 Update command.cpp (#1289)
Fixed typo in the command description.
2021-03-07 14:40:50 -05:00
Michael Cook (mackal) d5d6b911b0 Merge pull request #1286 from EQEmu/bug_fix/petonspawn_copypasteerror
Fix copy and paste error
2021-03-06 20:09:12 -05:00
Michael Cook (mackal) 29cdca380f Fix copy and paste error 2021-03-06 19:58:18 -05:00
Alex e5f5db69b4 Merge pull request #1280 from EQEmu/bug_fix/strcpy_overlap_GetGroupLeadershipInfo
[ASan] Fix strcpy-param-overlap with GetGroupLeadershipInfo calls
2021-03-05 19:24:42 -08:00
Alex d635e69ee3 Merge pull request #1283 from EQEmu/cleanup/Wformat-overflow
[Cleanup] Make code -Wformat-overflow safe
2021-03-05 19:23:48 -08:00
Alex a1531aa057 Merge pull request #1282 from EQEmu/bug_fix/spawngroup_leak_repop
[Leak] Port SpawnGroup stuff to unique_ptr to fix leak
2021-03-05 19:23:00 -08:00
Alex b24ba221e9 Merge pull request #1279 from EQEmu/bug_fix/group_delete
[ASan] Fix heap-use-after-free issue with groups
2021-03-05 19:20:34 -08:00
Alex 253f0594e4 Merge pull request #1278 from EQEmu/akkadius/fix-skill-caps-loading-consistency
[Bugfix] Fix Skill Caps Loading References
2021-03-05 19:20:11 -08:00
Alex 02517bf6ab Merge pull request #1276 from EQEmu/cleanup/uv_handle_cast_deletes
[ASan] Use casts to silence ASan complaints
2021-03-05 19:19:42 -08:00
Alex 184128a79b Merge pull request #1275 from EQEmu/bug_fix/stack-buffer-overflow_StopLFP
[ASan] Fix stack-buffer-overflow thanks to StopLFP
2021-03-05 19:17:12 -08:00
Alex 93869dbef6 Merge pull request #1273 from EQEmu/hate_list_quest_api
[Quest API] Add GetHateClosest() and GetHateListByDistance(distance) to Perl and Lua.
2021-03-05 19:16:38 -08:00
Alex af82a6c5d5 Merge pull request #1272 from noudess/master
[Bug Fix] Do not summon pet or set new pet state when PC summoned by a mob
2021-03-05 19:16:03 -08:00
Alex fdca333280 Merge pull request #1271 from EQEmu/cleanup/world_client_clearance
[ASan] Make Client::Clearance less gross
2021-03-05 19:14:26 -08:00
Alex c954c08c07 Merge pull request #1267 from EQEmu/bug_fix/realodquest_encounter_crash
[Crash] Fix ReloadQuest on Shutdown crash related to encounters
2021-03-05 19:13:58 -08:00
Michael Cook (mackal) 0b8220be32 Clean up last name handling in NPC::PetOnSpawn
Same as last time
2021-03-05 15:51:59 -05:00
Michael Cook (mackal) f7d40ec88e Clean up Merc::LoadMerc lastname processing
This is still less than ideal, but client's name restrictions should
prevent this from being an actual problem
2021-03-05 15:43:06 -05:00
Michael Cook (mackal) 316336d1cf Nuke ZoneDatabase::GetEventLogs
This wasn't called anywhere and was throwing format-overflow warnings
2021-03-05 15:25:32 -05:00
Michael Cook (mackal) 224c26620e Clean up MOTD processing 2021-03-05 15:24:40 -05:00
Michael Cook (mackal) c6d5864aa9 Port SpawnGroup stuff to unique_ptr to fix leak
This was leaking on #repop, unsure of other cases, smart pointers should
cover us though.

Direct leak of 3600 byte(s) in 18 object(s) allocated from:
    #0 0x7f2b3dbe0d30 in operator new(unsigned long) (/lib/x86_64-linux-gnu/libasan.so.5+0xead30)
    #1 0x5645dc7c9dff in ZoneDatabase::LoadSpawnGroups(char const*, unsigned short, SpawnGroupList*) ../zone/spawngroup.cpp:241
    #2 0x5645dc9db3f5 in Zone::Depop(bool) ../zone/zone.cpp:1746
    #3 0x5645dca1ba6b in Zone::Repop(unsigned int) ../zone/zone.cpp:1777
    #4 0x5645db4624b7 in command_repop(Client*, Seperator const*) ../zone/command.cpp:5683

Indirect leak of 6552 byte(s) in 273 object(s) allocated from:
    #0 0x7f26f2ff8d30 in operator new(unsigned long) (/lib/x86_64-linux-gnu/libasan.so.5+0xead30)
    #1 0x558d00490bc6 in __gnu_cxx::new_allocator<std::_List_node<SpawnEntry*> >::allocate(unsigned long, void const*) /usr/include/c++/8/ext/new_allocator.h:111
    #2 0x558d00490bc6 in std::allocator_traits<std::allocator<std::_List_node<SpawnEntry*> > >::allocate(std::allocator<std::_List_node<SpawnEntry*> >&, unsigned long) /usr/include/c++/8/bits/alloc_traits.h:436
    #3 0x558d00490bc6 in std::__cxx11::_List_base<SpawnEntry*, std::allocator<SpawnEntry*> >::_M_get_node() /usr/include/c++/8/bits/stl_list.h:450
    #4 0x558d00490bc6 in std::_List_node<SpawnEntry*>* std::__cxx11::list<SpawnEntry*, std::allocator<SpawnEntry*> >::_M_create_node<SpawnEntry* const&>(SpawnEntry* const&) /usr/include/c++/8/bits/stl_list.h:642
    #5 0x558d00490bc6 in void std::__cxx11::list<SpawnEntry*, std::allocator<SpawnEntry*> >::_M_insert<SpawnEntry* const&>(std::_List_iterator<SpawnEntry*>, SpawnEntry* const&) /usr/include/c++/8/bits/stl_list.h:1903
    #6 0x558d00490bc6 in std::__cxx11::list<SpawnEntry*, std::allocator<SpawnEntry*> >::push_back(SpawnEntry* const&) /usr/include/c++/8/bits/stl_list.h:1220
    #7 0x558d00490bc6 in SpawnGroup::AddSpawnEntry(SpawnEntry*) ../zone/spawngroup.cpp:122
    #8 0x558d00490bc6 in ZoneDatabase::LoadSpawnGroups(char const*, unsigned short, SpawnGroupList*) ../zone/spawngroup.cpp:291
    #9 0x558d006a1465 in Zone::Depop(bool) ../zone/zone.cpp:1746
    #10 0x558d006e1adb in Zone::Repop(unsigned int) ../zone/zone.cpp:1777
2021-03-02 12:39:04 -05:00
Michael Cook (mackal) c45395be95 Fix strcpy-param-overlap with GetGroupLeadershipInfo calls
==1810==ERROR: AddressSanitizer: strcpy-param-overlap: memory ranges [0x7ffef04baf90,0x7ffef04baf98) and [0x7ffef04baf90, 0x7ffef04baf98) overlap
    #0 0x7f163bb9509e  (/lib/x86_64-linux-gnu/libasan.so.5+0x4f09e)
    #1 0x5652caed27b3 in Client::Handle_Connect_OP_ZoneEntry(EQApplicationPacket const*) ../zone/client_packet.cpp:1535

==1918==ERROR: AddressSanitizer: strcpy-param-overlap: memory ranges [0x7ffddc8057c0,0x7ffddc8057c8) and [0x7ffddc8057c0, 0x7ffddc8057c8) overlap
    #0 0x7fc61ee0e09e  (/lib/x86_64-linux-gnu/libasan.so.5+0x4f09e)
    #1 0x56023c149698 in WorldServer::HandleMessage(unsigned short, EQ::Net::Packet const&) ../zone/worldserver.cpp:1055
2021-02-28 21:42:51 -05:00
Michael Cook (mackal) 6d47351d15 Fix heap-use-after-free issue with groups
==2317==ERROR: AddressSanitizer: heap-use-after-free on address 0x6170000633c0 at pc 0x55ed1d8e8d8b bp 0x7ffda4bef580 sp 0x7ffda4bef578
WRITE of size 8 at 0x6170000633c0 thread T0
    #0 0x55ed1d8e8d8a in Group::SetLeader(Mob*) ../zone/groups.h:80
    #1 0x55ed1d8e8d8a in Group::DisbandGroup(bool) ../zone/groups.cpp:1016

ASan didn't like this
2021-02-28 21:40:50 -05:00
Akkadius 450c748299 Fix database connection pointer bucket consistency 2021-02-28 19:31:46 -06:00
Michael Cook (mackal) cafae9d8c6 Use casts to silence ASan complaints
I don't think these are actually causing any real problems, ASan
complains about them though since it's kind of a code smell I guess and
a potential source of problems. But our case is fine, so cast to silence
them.
2021-02-28 18:01:34 -05:00
Michael Cook (mackal) b82f376bfb Fix stack-buffer-overflow thanks to StopLFP
==1674==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffb47f3068 at pc 0x7f64ee1f531e bp 0x7fffb47f2f50 sp 0x7fffb47f2700
READ of size 432 at 0x7fffb47f3068 thread T0
    #0 0x7f64ee1f531d  (/lib/x86_64-linux-gnu/libasan.so.5+0x3f31d)
    #1 0x55c78e8d002e in WorldServer::UpdateLFP(unsigned int, unsigned char, unsigned char, unsigned int, unsigned int, unsigned int, char const*, GroupLFPMemberEntry*) ../zone/worldserver.cpp:3166
    #2 0x55c78e8d01d9 in WorldServer::StopLFP(unsigned int) ../zone/worldserver.cpp:3180
2021-02-28 17:50:07 -05:00
Michael Cook (mackal) 66f89416d5 Merge pull request #1270 from EQEmu/bug_fix/dbcore_wrong_delete
Fix deletes in DBcore::Open
2021-02-27 15:30:06 -05:00
Michael Cook (mackal) 11d0da9560 Merge pull request #1274 from EQEmu/bug_fix/zlibng-pathfix
Fix zlibng paths for appveyor
2021-02-27 14:09:51 -05:00
Michael Cook (mackal) 8de9e86fed Merge pull request #1266 from EQEmu/bug_fix/init_PhR
Initialize Mob::PhR
2021-02-27 12:29:54 -05:00
Michael Cook (mackal) 05c407fbb2 Fix zlibng paths for appveyor 2021-02-27 12:12:41 -05:00
Michael Cook (mackal) aaf41001f1 zlib-ng1.dll ends up in a different path (#1268) 2021-02-27 02:57:04 -06:00
Alex af517be184 Merge branch 'master' into hate_list_quest_api 2021-02-25 22:58:41 -05:00
Kinglykrab 1af1b7bbdc [Quest API] Add GetHateClosest() and GetHateListByDistance(distance) to Perl/Lua. 2021-02-25 22:53:33 -05:00
Noudess 1f3ce2b34d Remove pet move/follow on non-GM summon PCy 2021-02-25 12:12:25 -05:00
Noudess 2f239fd6a3 Don't take pet guard off when PC is summoned 2021-02-25 07:38:16 -05:00
Michael Cook (mackal) ab005e5950 [Cleanup] Make Client::Clearance less gross
It's still pretty gross, but the bits ASan really hated are less gross
2021-02-25 01:50:58 -05:00
Michael Cook (mackal) 7349f99ba2 Fix deletes in DBcore::Open
These are arrays!
2021-02-25 00:07:36 -05:00
Michael Cook (mackal) 3e7d4d1d6b We want GetEncounterName here instead 2021-02-24 02:52:15 -05:00
Michael Cook (mackal) 43fade82e5 Fix ReloadQuest on Shutdown crash related to encounters
Basically, EntityList::RemoveAllEncounters is called before ReloadQuests
resulting in stale pointers in the lua_encounters map.

We just have to remove the entry from the map.
2021-02-24 01:03:38 -05:00
Michael Cook (mackal) 3630f3ec38 Initialize Mob::PhR 2021-02-23 22:34:14 -05:00
Alex 66d24ff419 [Quest API] Add IsHorse() to Perl and Lua. (#1264) 2021-02-23 20:50:06 -06:00
Alex 2346b0f6ab Fix SQL for NPC Spells. (#1265)
* Fix SQL for NPC Spells.

* Update 2021_02_15_npc_spell_entries_unsigned.sql
2021-02-23 21:32:06 -05:00
Alex 2957f5084d [Library] Update zlibng (#1255)
* Update zlibng

* Set cmake path more directly in zlibng to hopefully fix an issue with the build on drone

* I'm dumb, missing / in path

* Mackal helps with a dumb gitignore issue

* Adding all the files, not sure what's ignoring them and im tired of looking

* Some tweaks to zlibng build to hopefully get it to build properly. works on msvc now
2021-02-23 19:00:26 -06:00
Alex e6dee96266 Convert NPC Spell AI from int16 to uint16. (#1262) 2021-02-23 18:33:33 -06:00
Michael Cook (mackal) 86ce506956 [Cleanup] Nuke Make/AppendAnyLenString (#1251)
* Add a std::string overload for Database::SetMQDetectionFlag

* Replace calls to MakeAnyLenString in client_packet.cpp

At least the SetMQDetectionFlag ones

* Replace MakeAnyLenString calls in client_process

At least SetMQDectectionFlag ones

* Replace MakeAnyLenString in embparser

fmtlib actually is gross here, oh well.

* Replace MakeAnyLenString in merc

* Replace MakeAnyLenString in inventory

Also if'd out an unfinished implementation of Client::GetItemLinkHash

* Replace AppendAnyLenString in zonelist

* Replace AppendAnyLenString in zonelist

* Replace MakeAnyLenString in clientlist

* Nuke MakeAnyLenString/AppendAnyLenString

* Fix formatting string in zonelist
2021-02-23 18:32:19 -06:00
Michael Cook (mackal) 7a46a6595c [Cleanup] use std::make_unique (#1259)
* Convert common/eq_limits.cpp to use make_unique

* Convert common/net/console_server.cpp to use make_unique

* Convert common/net/servertalk_client_connection.cpp to use make_unique

* Convert common/net/servertalk_legacy_client_connection.cpp to use make_unique

* Convert common/net/servertalk_server.cpp to use make_unique

* Convert common/net/websocket_server.cpp to use make_unique

* Convert common/net/websocket_server_connection.cpp to use make_unique

* Convert common/shareddb.cpp to use make_unique

* Convert eqlaunch/worldserver.cpp to use make_unique

* Convert loginserver/server_manager.cpp to use make_unique

* Convert loginserver/world_server.cpp to use make_unique

* Convert queryserv/worldserver.cpp to use make_unique

* Convert ucs/worldserver.cpp to use make_unique

* Convert world/clientlist.cpp to use make_unique

* Convert world/expedition.cpp to use make_unique

* Convert world/launcher_link.cpp to use make_unique

* Convert world/login_server.cpp to use make_unique

* Convert world/main.cpp to use make_unique

* Convert world/ucs.cpp to use make_unique

* Convert world/web_interface.cpp to use make_unique

* Convert world/zonelist.cpp to use make_unique

* Convert world/zoneserver.cpp to use make_unique

* Convert zone/client.cpp to use make_unique

* Convert zone/corpse.cpp to use make_unique

* Convert zone/dynamiczone.cpp to use make_unique

* Convert zone/expedition.cpp to use make_unique

* Convert zone/main.cpp to use make_unique

* Convert zone/mob_ai.cpp to use make_unique

* Convert zone/mob_movement_manager.cpp to use make_unique

* Convert zone/pathfinder_nav_mesh.cpp to use make_unique

* Convert zone/worldserver.cpp to use make_unique
2021-02-23 18:30:46 -06:00
TurmoilToad fa9478ac44 [Quest API] Perl Entity List Annotations (#1243)
Added category tag annotations for perl entity list methods.
2021-02-23 12:03:16 -06:00
TurmoilToad cc7904e1bc [Quest API] Perl Hate Entry Annotations (#1244)
Added category tag annotations for Hate Entry methods.
2021-02-23 12:02:51 -06:00
TurmoilToad dba69abefc [Quest API] Perl Door Annotations (#1241)
Add category type annotations to door methods.
2021-02-23 12:00:11 -06:00
TurmoilToad 041879c4e6 [Quest API] Perl NPC Annotations (#1245)
Added category tag annotations for NPC methods.
2021-02-23 11:59:57 -06:00
Michael Cook (mackal) 0887eb0976 Fix NPC Scale Manager leaking (#1254)
It should be fine to init further down after the early returns.

This wasn't really a leak that affected performance, but mainly moving
to shutup valgrind
2021-02-23 11:59:03 -06:00
TurmoilToad f8edde9587 [Quest API] Perl Mob Annotations (#1258)
Added category tag annotations for mob methods.
2021-02-23 11:54:01 -06:00
Michael Cook (mackal) 74ce20b256 Add string util search_deliminated_string (#1260)
This function takes a string of deliminated an see if another string is
one of those

This function also verifies it's not finding a substring
2021-02-23 11:52:34 -06:00
TurmoilToad 1cfdd7e4a2 [Quest API] Perl Group Annotations (#1261)
Added category tag annotations for group methods.
2021-02-23 11:51:51 -06:00
Alex bf3593a60d [Experience] Add exp mod to npc types to let a server op change the exp modifier (#1252)
* Add exp mod to npc types to let a server op change the exp modifier a npc gives (useful for custom content)

* Updated version.h
2021-02-23 11:50:38 -06:00
Alex 65704274cb [Quest API] Resolves traindiscs and scribespells issues in Perl/Lua. (#1249) 2021-02-14 19:15:09 -05:00
Michael Cook (mackal) 1bc9e8aff2 Merge pull request #1239 from noudess/sneak-pull
[Game Play Mechanic] Very simple implementation of Sneak Pull
2021-02-14 18:04:30 -05:00
KimLS c23da55b95 Fix for issue in movement manager where a drop aggro can happen and processing continues. 2021-02-14 13:08:33 -08:00
Michael Cook (mackal) 2a37785a7c Merge pull request #1248 from EQEmu/remove_unused_files
[Cleanup] Remove unused files
2021-02-14 14:20:40 -05:00
Michael Cook (mackal) 0ef01165ea Fix some leaks of groups/raids (#1242)
These cases probably are exceedingly rare, but they still need to be
accounted for. (As in, I don't think anyone has run into these cases too
often to cause problems)
2021-02-12 02:07:58 -06:00
Michael Cook (mackal) f9923ffda0 Fix va_list leaks in MakeAnyLenString/AppendAnyLenString (#1240)
Slowly leaking memory for ages!

clang-tidy complained about it
2021-02-12 02:07:47 -06:00
Akkadius 6e765e7ddc Revert "[BUG] Fix for Group Leader Disband Issue"
This reverts commit f854137ca0.
2021-02-12 02:05:20 -06:00
Michael Cook (mackal) 8b4a886d01 Remove unused files
idk where these came from, NUKE EM!
2021-02-12 02:42:03 -05:00
Michael Cook (mackal) 507bbe83f3 LuaJIT calls it lua51.lib/dll on Windows ... (#1247) 2021-02-11 13:52:11 -06:00
Michael Cook (mackal) d33f806efa Add include to PATH_SUFFIXES for Windows builds (#1246) 2021-02-11 12:56:00 -06:00
Noudess d7d9c73e5e Add comment. 2021-02-09 11:32:13 -05:00
Noudess d90d680e8a More formatting 2021-02-09 11:24:25 -05:00
Noudess baa53e134a Fixed missing argument - oops 2021-02-09 10:00:17 -05:00
Noudess 3bafc5b3f4 Change modified sneak pull assist range to a rule. Fixed formatting on decls. 2021-02-09 09:50:22 -05:00
Noudess b2e4e91fbd Very simple implementation of Sneak Pull 2021-02-09 08:31:35 -05:00
Michael Cook (mackal) 10ffcf155d [Lua/Cmake] Prefer LuaJIT over normal Lua (#1235)
* Add a separate FindLuaJit.cmake

* Remove LuaJit from our modified FindLua51.cmake

* Make use of the new FindLuaJit

The reason for splitting them up like this is so we can have a
preference for LuaJIT that's not determined by the search order in
FindLua51.cmake as well as giving the server operators the choice to
prefer normal Lua with the EQEMU_PREFER_LUA cmake option
2021-02-08 23:10:16 -06:00
TurmoilToad ed71543dff Add category tags to new client methods. (#1233)
Add category tags to new client methods.
2021-02-08 23:09:42 -06:00
TurmoilToad 0dcaea1e4e Add category tags for Object methods. (#1232)
Add category tags for Object methods.
2021-02-08 23:09:16 -06:00
TurmoilToad 52a359180c Add category tags for corpse methods (#1234)
Add category tags for corpse methods.
2021-02-08 23:08:41 -06:00
Alex 8f89f38f5c Add ScaleNPC() to Perl and Lua. (#1238) 2021-02-08 23:08:07 -06:00
Alex f2b67ae969 [Quest API] Add Mob-based data bucket methods to Perl/Lua. (#1237)
* Add Mob-based data bucket methods to Perl/Lua.

* Update mob.cpp

* Update perl_mob.cpp
2021-02-08 23:06:33 -06:00
Akkadius ef0398ebd3 Move data aliases after null checks for safety [skip ci] 2021-02-08 21:50:28 -06:00
Akkadius dcc921efcb Update repo with latest template [skip ci] 2021-02-08 21:35:43 -06:00
Akkadius eedd5e2821 [Hotfix] Remove test branch fields from repo 2021-02-08 21:34:33 -06:00
Chris Miles 96b65b848b [Repositories] Insert repository improvements (#1236)
* Insert repository improvements

* Remove no longer necessary code, remove license banner since we have a license at the repo level

* Update template comments
2021-02-08 20:56:44 -06:00
Chris Miles 694d380e66 [Door Opening] Rule to let configure Animal Door Opening (#1231)
* Add rule configuration for letting animals open doors or not

* Handle one more spot

* Make adjustments and add mob property that serves as a check as to whether a mob entity can open doors or not

* Push attribute to mob window
2021-02-07 19:52:58 -06:00
Michael Cook (mackal) 672c09ee11 Provide more search paths for luajit (#1216)
The include folder on my system is /usr/include/luajit-2.0, added some
extra library names since mine was /usr/lib64/libluajit-5.1.so
2021-02-07 18:42:55 -06:00
TurmoilToad ca9756abc9 [Quest API] Perl Client Annotations (#1224)
* Update perl_client.cpp

Added category tags for client methods.

* Update perl_client.cpp

Now with less iis!  (Thanks KK)

* Update perl_client.cpp

Now with fewer slashes!

* Update perl_client.cpp

Now with fewer tabs!
2021-02-07 18:13:04 -06:00
TurmoilToad da7b5b3560 [Quest API] Perl Raid Annotations (#1226)
Added categories tags for raid methods.
2021-02-07 18:12:09 -06:00
TurmoilToad ecc1dd9475 Update perl_questitem.cpp (#1227)
Add category tags for quest_item methods.
2021-02-07 18:11:24 -06:00
Chris Miles 8f7702095b Merge pull request #1228 from EQEmu/anon_afk_client
[Quest API] Add Anon/AFK methods to Perl and Lua.
2021-02-07 18:09:49 -06:00
Chris Miles 13303a1e14 Merge pull request #1230 from EQEmu/bug_fix/name_enforcement
[Character Validation] Enforce some naming limits people were getting around
2021-02-07 18:09:22 -06:00
Chris Miles b184a5d013 Merge pull request #1229 from EQEmu/akkadius/task-code-cleanup
[Refactor and Cleanup] Task Code
2021-02-07 18:06:44 -06:00
Akkadius 9f5ce8e3c9 PR comments 2021-02-07 17:08:16 -06:00
Michael Cook (mackal) 6621338064 Enforce some naming limits people were getting around 2021-02-07 17:00:48 -05:00
Akkadius 00902d8a7e Private member prefixes for proximities and goal lists 2021-02-07 15:44:25 -06:00
Akkadius 01f69bcc51 Update task_client_state.cpp 2021-02-07 15:22:30 -06:00
Akkadius f429df39a9 Update CMakeLists.txt 2021-02-07 15:06:46 -06:00
Akkadius 0c533071d4 Yet more cleanup 2021-02-07 15:00:16 -06:00
Kinglykrab fac9c3469f Add Anon/AFK methods to Perl and Lua. 2021-02-07 00:40:08 -05:00
Akkadius 8414973077 Typo [skip ci] 2021-02-06 21:40:42 -06:00
Akkadius 5fba138a5a Improve GM command interface UI 2021-02-06 21:14:25 -06:00
Akkadius 053bdb8646 More cleanups 2021-02-06 19:19:20 -06:00
Akkadius ff5ea82e38 Split task classes into their own cpp/h files to speed up incremental compilation and make things easier to maintain 2021-02-06 18:52:14 -06:00
Akkadius 55d4865d36 Correct one missed repository pointer 2021-02-06 18:16:39 -06:00
Akkadius b01793081a More cleanup 2021-02-06 17:38:11 -06:00
Chris Miles 18e9c4dc95 Merge pull request #1225 from EQEmu/akkadius/repository-improvements
[Repositories] Explicitly pass database pointers to repository methods
2021-02-06 14:23:54 -06:00
Akkadius ed9f155f7c More logging 2021-02-06 04:37:16 -06:00
Akkadius d83dc339fc Logging cleanups 2021-02-06 04:27:41 -06:00
Akkadius 8d7fdd6549 More cleanups 2021-02-06 04:12:11 -06:00
Akkadius 65f2f823a8 More refactors 2021-02-06 03:57:46 -06:00
Akkadius fac75a3ae0 Move ClientTaskState::RemoveTaskByTaskID to repository methods 2021-02-06 03:46:03 -06:00
Akkadius 19e9c0bc22 Move ClientTaskState::RemoveTask to repository methods 2021-02-06 03:44:36 -06:00
Akkadius 9816608bba Another pass 2021-02-06 03:42:14 -06:00
Akkadius 83b279bac3 Migrate TaskManager::LoadClientState to repository methods 2021-02-06 03:00:14 -06:00
Akkadius 32aeb6197f Refactor and move TaskManager::LoadTasks to load from repositories 2021-02-06 02:33:07 -06:00
Akkadius 11eab9c284 Move TaskManager::LoadTaskSets() loading to repositories 2021-02-06 01:37:30 -06:00
Akkadius 8d863a507b Fourth pass 2021-02-06 01:25:03 -06:00
Akkadius c194e2ac9c Fix linux compile warnings 2021-02-06 01:22:22 -06:00
Akkadius aeb0dbc6ae Third pass 2021-02-06 01:14:32 -06:00
Akkadius 4039cb12ba Second pass 2021-02-06 01:05:34 -06:00
Akkadius b7983d4c20 First pass 2021-02-06 00:45:13 -06:00
Akkadius e8ab176d4a Explicitly pass database pointers to repository methods 2021-02-05 23:00:27 -06:00
Chris Miles b7f7c66a50 Merge pull request #1223 from EQEmu/akkadius/update-repositories-expeditions
[Repositories] Add expedition repositories
2021-02-05 22:45:38 -06:00
Chris Miles 3455863099 Merge pull request #1220 from EQEmu/perl_npc_formatting
Formatting NPC validation macro.
2021-02-05 22:14:34 -06:00
Akkadius 7fe0bbacd4 Add expedition repositories 2021-02-05 18:12:05 -06:00
Michael Cook (mackal) c8dfb72cd2 Merge pull request #1222 from EQEmu/feature/op_clearaa_tit
Identify OP_ClearLeadershipAbilities/OP_ClearAA for Tit
2021-02-05 16:18:19 -05:00
Michael Cook (mackal) 42b34bbf87 Identify OP_ClearLeadershipAbilities/OP_ClearAA for Tit 2021-02-05 14:17:13 -05:00
Kinglykrab 963b8fdd53 Formatting NPC validation macro. 2021-02-02 17:06:55 -05:00
Chris Miles 0923ff040f Merge pull request #1204 from EQEmu/perl_client_macro
[Quest API] Perl Client Validation Macro
2021-02-01 23:24:54 -06:00
Chris Miles 369461f9e1 Merge pull request #1205 from EQEmu/perl_doors_macro
[Quest API] Perl Doors Validation Macro
2021-02-01 23:24:26 -06:00
Chris Miles bb2dcdcb31 Merge pull request #1206 from EQEmu/perl_entity_macro
[Quest API] Perl Entity Validation Macro
2021-02-01 23:24:09 -06:00
Chris Miles e67b3dd6d4 Merge pull request #1207 from EQEmu/perl_group_macro
[Quest API] Perl Group Validation Macro
2021-02-01 23:23:46 -06:00
Chris Miles ddfc0dda42 Merge pull request #1208 from EQEmu/perl_hate_macro
[Quest API] Perl Hate Validation Macro
2021-02-01 23:23:21 -06:00
Chris Miles f7cc51c134 Merge pull request #1209 from EQEmu/perl_mob_macro
[Quest API] Perl Mob Validation Macro
2021-02-01 23:22:52 -06:00
Chris Miles 1b27d9dc9d Merge pull request #1210 from EQEmu/perl_npc_macro
[Quest API] Perl NPC Validation Macro
2021-02-01 23:19:09 -06:00
Chris Miles 8011c4afcc Merge pull request #1211 from EQEmu/perl_object_macro
[Quest API] Perl Object Validation Macro
2021-02-01 23:18:10 -06:00
Chris Miles 69de53c459 Merge pull request #1212 from EQEmu/perl_packet_macro
[Quest API] Perl Packet Validation Macro
2021-02-01 23:17:53 -06:00
Chris Miles 82b3cccc95 Merge pull request #1213 from EQEmu/perl_corpse_macro
[Quest API] Perl Corpse Validation Macro
2021-02-01 23:17:22 -06:00
Chris Miles 91d9a4f73c Merge pull request #1214 from EQEmu/perl_item_macro
[Quest API] Perl Item Validation Macro
2021-02-01 23:17:05 -06:00
Chris Miles 93f83923ce Merge pull request #1215 from EQEmu/perl_raid_macro
[Quest API] Perl Raid Validation Macro
2021-02-01 23:16:41 -06:00
Kinglykrab 9759208ed6 [Quest API] Perl Raid Validation Macro
Add validation macro to all raid methods.
2021-02-01 22:38:19 -05:00
Kinglykrab 9d3d9a97ff [Quest API] Perl Item Validation Macro
Add validation macro to all item methods.
2021-02-01 22:36:26 -05:00
Kinglykrab a29de5963f [Quest API] Perl Corpse Validation Macro
Add validation macro to all corpse methods.
2021-02-01 22:34:47 -05:00
Kinglykrab 381b029ffc [Quest API] Perl Packet Validation Macro
Add validation macro to all packet methods.
2021-02-01 22:32:43 -05:00
Kinglykrab 772c88d020 [Quest API] Perl Object Validation Macro
Add validation macro to all object methods.
2021-02-01 22:30:34 -05:00
Kinglykrab b69213abcc [Quest API] Perl NPC Validation Macro
Add validation macro to all NPC methods.
2021-02-01 22:28:15 -05:00
Kinglykrab 4338d657fc [Quest API] Perl Mob Validation Macro
Add validation macro to all mob methods.
2021-02-01 22:24:36 -05:00
Kinglykrab 2430b38406 [Quest API] Perl Hate Validation Macro
Add validation macro to all hate methods.
2021-02-01 22:16:44 -05:00
Kinglykrab 6cfe7853f5 [Quest API] Perl Group Validation Macro
Add validation macro to all group methods.
2021-02-01 22:10:50 -05:00
Kinglykrab 64c97a5283 [Quest API] Perl Entity Validation Macro
Add validation macro to all entitylist methods.
2021-02-01 22:06:41 -05:00
Kinglykrab f32f4346e7 [Quest API] Perl Doors Validation Macro
Add validation macro to all door methods.
2021-02-01 22:02:17 -05:00
Kinglykrab dcc2dcdb8d Convert perl_client.cpp to use validation macro. 2021-02-01 21:56:47 -05:00
Chris Miles 9b8845949e Merge pull request #1203 from EQEmu/perl_inventory
[Quest API] Add Inventory methods to Perl
2021-02-01 20:16:55 -06:00
Kinglykrab 36bfebfe6a Add Inventory methods to Perl.
- Add $client->GetInventory() to Perl.
- Export Lua Inventory methods to Perl.
 - Add quest::createitem(item_id, charges, augment_one, augment_two, augment_three, augment_four, augment_five, augment_six, attuned) to Perl so you can return a ItemInstance for testing purposes.
2021-02-01 21:07:07 -05:00
Chris Miles 0c70004102 Merge pull request #1201 from splose/npcedit
[Command] Add raidtarget / respawntimer to #npcedit
2021-02-01 12:56:55 -06:00
Chris Miles 5238d30236 Merge pull request #1202 from regneq/master
RandomPath improvements
2021-02-01 12:56:06 -06:00
regneq 58e0ce6a4b fixed the references from previous commits. 2021-01-31 16:53:25 -08:00
regneq e4b437cb5f RandomPath grid type improvement
RandomPath has been changed to the following behavior:

* When stopped at a waypoint, it will now use the waypoint's pause timer if it is non-zero.  If it is zero, it will use the first waypoint's pause timer if that is non-zero.  If both are zero it will use 38 seconds.  Previously it would always use the first waypoint's pause timer if it was non-zero.  This new way is what it should have been from the start, really.

* If any waypoint is flagged as a centerpoint, then the NPCs will always return to that first randomly selected centerpoint waypoint after moving.  I.e. every other move will be to the first waypoint if the bool is set.

If any waypoint has a negative number (-1, -10, etc) in the pause timer. It will not be included in the waypoints to be random.  Instead the npc will just path through it everytime.  This is useful for a path to only select a small area to pause at before returning to it's centerpoints or another random waypoints in between it.
2021-01-31 15:11:45 -08:00
regneq 5a94e82db8 Merge pull request #7 from EQEmu/master
update
2021-01-31 14:01:54 -08:00
Alex 9713d62849 Merge pull request #1200 from hgtw/fix/empty-expedition-invite
Verify expedition is not empty on invites
2021-01-30 21:43:35 -05:00
Matthew Silvia a751339c99 add raidtarget / respawntimer to #npcedit 2021-01-30 19:43:37 -05:00
hg 62e480fed7 Verify expedition is not empty on invites
Fixes an edge case where a member could accept a pending invite into an
empty expedition before world could invalidate it
2021-01-30 18:58:39 -05:00
Chris Miles b74edd9dc2 Merge pull request #1196 from EQEmu/spell_lua_perl
Add new Spell methods to Perl and Lua.
2021-01-30 17:27:15 -06:00
Chris Miles 7eba9552e2 Merge pull request #1193 from noudess/gmmove
Use heading in GMMove and change FaceTarget not to turn boat
2021-01-30 15:29:05 -06:00
Chris Miles 396c300315 Merge pull request #1198 from EQEmu/akkadius/fix-mysqldump-buffer-allocation-edge-case
[Bugfix] Fix MySQL Dump Buffer Allocation
2021-01-29 23:51:19 -06:00
Akkadius c192590af6 Fix issue where sometimes under certain circumstances when issuing a database dump with large data over a network with extended inserts we hit a buffer threshold that kills a MySQL dump with Error 2013 2021-01-29 18:13:37 -06:00
JJ fb5fc935e7 Merge pull request #1197 from EQEmu/perl_target_ring
Fix GetTargetRingX(), GetTargetRingY(), and GetTargetRingZ() in Perl.
2021-01-28 23:34:00 -06:00
JJ 780c7a8476 Merge pull request #1195 from hgtw/feat/color-constants
Add missing chat color constants to Lua
2021-01-28 23:33:44 -06:00
JJ c72e18f082 Merge pull request #1194 from hgtw/fix/unescaped-fmt
Replace unescaped braces in format string
2021-01-28 23:33:31 -06:00
Kinglykrab a90d836bcd Fix GetTargetRingX(), GetTargetRingY(), and GetTargetRingZ() in Perl. 2021-01-28 20:29:50 -05:00
Kinglykrab c0129a6b8a Add new Spell methods to Perl and Lua. 2021-01-28 20:12:57 -05:00
hg a77d2408ac Add missing chat color constants to Lua 2021-01-28 20:10:26 -05:00
hg 6baf8412c6 Replace unescaped braces in format string
Fixes zone crash when this is logged
2021-01-28 19:42:02 -05:00
Noudess 9907984aca Use passed heading in GMMove and change FaceTarget not to turn if npc is boat. 2021-01-26 09:08:45 -05:00
Chris Miles f767a7c076 Merge pull request #1191 from EQEmu/immune_aggro
Add 4 new special attacks to Perl/Lua.
2021-01-25 19:14:28 -06:00
Chris Miles 445fcc2d40 Merge pull request #1188 from EQEmu/message_whisper
Add message(color, message) and whisper(message) to Perl/Lua.
2021-01-25 17:21:56 -06:00
Chris Miles f4ee11ac62 Merge pull request #1189 from EQEmu/popup2
Fix Popup2 Perl croak.
2021-01-25 17:21:40 -06:00
Kinglykrab d30593c35e Add 4 new special attacks to Perl/Lua.
- IMMUNE_DAMAGE_CLIENT (47)
Immune to all damage except NPC damage.

- IMMUNE_DAMAGE_NPC (48)
Immune to all damage except Client damage.

- IMMUNE_AGGRO_CLIENT (49)
Immune to aggro by a Client.

- IMMUNE_AGGRO_NPC (50)
Immune to aggro by an NPC, clients must attack directly to gain aggro, allows pet only boss mechanics and stuff.
2021-01-23 21:36:07 -05:00
Kinglykrab 102263f37d Fix Popup2 Perl croak.
Noticed the Gitbook documentation listed SendFullPopup not Popup2 due to parsing the Perl croaks in the files, causing people not to be able to find the proper way to send a full popup window.
2021-01-23 11:15:21 -05:00
Kinglykrab 19ae461e36 Add message(color, message) and whisper(message) to Perl/Lua.
- Add quest::message(color, message) to Perl.
- Add eq.message(color, message) to Lua.
- Add quest::whisper(message) to Perl.
- Add eq.whisper(message) to Lua.

These methods allow you to use implied client references. The whisper method also converts a widely used plugin in Perl to a Perl and Lua method that works on both Clients and NPCs.
2021-01-23 10:47:44 -05:00
Alex c481d52064 Add HasDisciplineLearned() to Perl/Lua. 2021-01-23 10:23:50 -05:00
Chris Miles 7c69400618 Merge pull request #1175 from EQEmu/akkadius/command-name-adjustment
[Command] Naming suggestions from https://github.com/EQEmu/Server/pull/1170
2021-01-21 18:26:35 -06:00
Chris Miles ca98ea9872 Merge pull request #1180 from noudess/boat
Allow boats flymode to be overridden by local db
2021-01-21 18:26:05 -06:00
Chris Miles 7d40e42cc2 Merge pull request #1177 from hgtw/fix/door-packets
[Bugfix] Don't respawn doors while clients are zoning
2021-01-21 18:22:53 -06:00
Chris Miles f1920f2132 Merge pull request #1178 from hgtw/fix/spawn-condition-crash
[Bugfix] Fix zone crash on spawn condition change
2021-01-21 18:22:27 -06:00
Chris Miles 30490abc50 Merge pull request #1179 from hgtw/fix/zonemap-crash
Fix zone startup crash if maps not installed
2021-01-21 18:22:04 -06:00
Chris Miles c5c0a3a73e Merge pull request #1181 from EQEmu/aa_message
Add AA gain messages.
2021-01-21 18:21:35 -06:00
Chris Miles 0551cfc013 Merge pull request #1182 from EQEmu/race_class
Add Race/Class Name and Bitmask Methods.
2021-01-21 18:19:56 -06:00
Chris Miles 1a2cec58f1 Merge pull request #1184 from EQEmu/finditem
#finditem Changes
2021-01-21 18:19:28 -06:00
Chris Miles a9b992a1b0 Merge pull request #1186 from hgtw/fix/expedition-max
Fix bug that could allow expeditions to exceed max members
2021-01-21 18:18:04 -06:00
hg d87ae839a2 Verify members in db on expedition invites
Fixes an exploit where multiple accepted cross zone invites could race
with cache updates and allow an expedition to exceed its max members
2021-01-21 19:02:00 -05:00
Kinglykrab 0f859a2a0f Preferential changes to #finditem, doesn't show stack options if item isn't stackable.
Only shows 1 or max stack size of item for summoning items. Also resolves the issues some people were having where this command would summon an item with 1 charge instead of max charges because 1 was supplied as charges. In my experience most people who summon items like this want either one item or a full stack of an item and the summon size here is relative to the current item's stack size. Also shows name first instead of ID so the formatting is better.
2021-01-19 18:34:19 -05:00
Kinglykrab 7e1e1651e4 Add GetClassBitmask(), GetClassName(), GetRaceBitmask(), and GetRaceName() to Perl/Lua. 2021-01-18 18:47:32 -05:00
Kinglykrab 1c00edb458 Add AA gain messages. 2021-01-15 19:54:44 -05:00
Noudess eb24e333d7 Allow boats flymode to be overridden by local db 2021-01-11 10:58:08 -05:00
hg 836210404c Fix zone crash on spawn condition change
The NPC pointer held by Spawn2 wasn't reset if the npc was depopped
without a respawn timer by #depop commands or depop(false) quest apis.
If the NPC was part of a spawn condition then the condition would try
to dereference that pointer (which gets deleted) on condition change.
2021-01-08 23:53:06 -05:00
hg 896dd48960 Fix zone startup crash if maps not installed 2021-01-08 20:55:56 -05:00
hg 312ee2b42c Don't respawn doors while clients are zoning
Fixes regression from b08dc02a (PR #1051)

The normal door list sent on zone entry caused unopenable double doors
on clients if an api respawned them while the client was zoning. This
waits until the client finishes zoning and has received the initial
door list before sending any despawn/respawn packets.
2021-01-07 20:05:55 -05:00
Akkadius 3fc1aea3ce Naming suggestions from https://github.com/EQEmu/Server/pull/1170 2021-01-04 11:44:23 -06:00
regneq ed351fb4cb Merge pull request #6 from EQEmu/master
update
2020-10-01 08:02:43 -07:00
regneq 7bea9a7273 Merge pull request #5 from EQEmu/master
eqemu merge update
2020-05-04 08:30:48 -07:00
579 changed files with 46274 additions and 37614 deletions
+18 -2
View File
@@ -55,6 +55,7 @@ FIND_PACKAGE(MariaDB)
FIND_PACKAGE(ZLIB)
FIND_PACKAGE(OpenSSL)
FIND_PACKAGE(Lua51)
FIND_PACKAGE(LuaJit)
FIND_PACKAGE(PerlLibs)
FIND_PACKAGE(Sodium)
FIND_PACKAGE(mbedTLS)
@@ -87,6 +88,12 @@ ELSE()
MESSAGE(STATUS "* Lua: MISSING *")
ENDIF()
IF(LuaJit_FOUND)
MESSAGE(STATUS "* LuaJIT: FOUND *")
ELSE()
MESSAGE(STATUS "* LuaJIT: MISSING *")
ENDIF()
IF(PerlLibs_FOUND)
MESSAGE(STATUS "* Perl: FOUND *")
ELSE()
@@ -122,6 +129,7 @@ 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_CLIENT_FILES "Build Client Import/Export Data Programs." ON)
OPTION(EQEMU_PREFER_LUA "Build with normal Lua even if LuaJIT is found." OFF)
IF(EQEMU_COMMANDS_LOGGING)
ADD_DEFINITIONS(-DCOMMANDS_LOGGING)
@@ -212,7 +220,12 @@ ELSE()
SET(SODIUM_LIBRARY_ENABLED OFF)
ENDIF()
IF(Lua51_FOUND)
IF(LUAJIT_FOUND AND NOT (EQEMU_PREFER_LUA AND Lua51_FOUND))
SET(LUA_LIBRARY_TYPE " LuaJIT")
SET(LUA_LIBRARY_ENABLED ON)
SET(LUA_LIBRARY_LIBS ${LUAJIT_LIBRARY} luabind)
SET(LUA_LIBRARY_INCLUDE ${LUAJIT_INCLUDE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/libs/luabind")
ELSEIF(Lua51_FOUND )
SET(LUA_LIBRARY_TYPE " Lua 5.1")
SET(LUA_LIBRARY_ENABLED ON)
SET(LUA_LIBRARY_LIBS ${LUA_LIBRARY} luabind)
@@ -239,6 +252,7 @@ IF(ZLIB_FOUND)
SET(ZLIB_LIBRARY_TYPE "zlib-ng")
SET(ZLIB_LIBRARY_LIBS "zlibstatic")
SET(ZLIB_LIBRARY_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/libs/zlibng")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_BINARY_DIR}/libs/zlibng")
ELSE()
SET(ZLIB_LIBRARY_TYPE " zlib")
SET(ZLIB_LIBRARY_LIBS ${ZLIB_LIBRARY})
@@ -299,7 +313,7 @@ IF(LUA_LIBRARY_ENABLED)
IF(EQEMU_BUILD_LUA)
ADD_DEFINITIONS(-DLUA_EQEMU)
SET(SERVER_LIBS ${SERVER_LIBS} ${LUA_LIBRARY_LIBS})
SET(ZONE_LIBS ${LUA_LIBRARY_LIBS})
INCLUDE_DIRECTORIES(SYSTEM "${LUA_LIBRARY_INCLUDE}")
OPTION(EQEMU_SANITIZE_LUA_LIBS "Sanitize Lua Libraries (Remove OS and IO standard libraries from being able to run)." ON)
@@ -334,6 +348,8 @@ IF(UNIX)
ENDIF()
ENDIF()
SET(ZONE_LIBS ${ZONE_LIBS} ${SERVER_LIBS})
IF(EQEMU_BUILD_LOGIN AND NOT TLS_LIBRARY_ENABLED)
MESSAGE(FATAL_ERROR "Login server requires a TLS Library to build.")
ENDIF()
+22
View File
@@ -0,0 +1,22 @@
We expect contributors and community members to act professionally and respectfully, and we expect our forums and Discord channels to be dignified environments that expand the community and enhance the learning experience for new members.
Specifically:
* Respect people, their ideas, and their work.
* Be kind. Be courteous. Be welcoming.
* Listen. Consider and acknowledge people's points before responding.
* Be respectful of differing viewpoints and experience levels.
* Accept constructive criticism and work together toward decisions.
* Focus on what is best for the community and users.
Examples of unacceptable behavior by participants include:
* The use of violent threats, trolling, insulting/derogatory comments, abusive or discriminatory language, or personal attacks.
* Public or private harassment.
* Publishing others' private information, such as a physical or electronic address, without explicit permission.
* Conduct which could reasonably be considered inappropriate in a professional setting.
* Advocating for or encouraging any of the above behaviors.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, forum posts, Discord messages, and other contributions that are not aligned with this code of conduct.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project.
+2 -2
View File
@@ -16,6 +16,6 @@ build:
verbosity: minimal
after_build:
- cmd: >-
7z a build_x64-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb
7z a build_x64-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb C:\projects\eqemu\build\libs\zlibng\RelWithDebInfo\*.dll
appveyor PushArtifact build_x64-bots.zip
appveyor PushArtifact build_x64-bots.zip
+2 -2
View File
@@ -16,6 +16,6 @@ build:
verbosity: minimal
after_build:
- cmd: >-
7z a build_x64-no-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb
7z a build_x64-no-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb C:\projects\eqemu\build\libs\zlibng\RelWithDebInfo\*.dll
appveyor PushArtifact build_x64-no-bots.zip
appveyor PushArtifact build_x64-no-bots.zip
+2 -2
View File
@@ -38,7 +38,7 @@ locations other than lua/
find_path(LUA_INCLUDE_DIR lua.h
HINTS
ENV LUA_DIR
PATH_SUFFIXES include/lua51 include/lua5.1 include/lua-5.1 include/lua include/luajit include
PATH_SUFFIXES include/lua51 include/lua5.1 include/lua-5.1 include/lua include
PATHS
~/Library/Frameworks
/Library/Frameworks
@@ -49,7 +49,7 @@ find_path(LUA_INCLUDE_DIR lua.h
)
find_library(LUA_LIBRARY
NAMES lua51 lua5.1 lua-5.1 lua luajit
NAMES lua51 lua5.1 lua-5.1 lua
HINTS
ENV LUA_DIR
PATH_SUFFIXES lib
+91
View File
@@ -0,0 +1,91 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
# Modified from the FindLua51 that comes with CMake
#[=======================================================================[.rst:
FindLuaJit
---------
Locate LuaJit library This module defines
::
LUAJIT_FOUND, if false, do not try to link to Lua
LUAJIT_LIBRARIES
LUAJIT_INCLUDE_DIR, where to find lua.h
LUAJIT_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
Note that the expected include convention is
::
#include "lua.h"
and not
::
#include <lua/lua.h>
This is because, the lua location is not standardized and may exist in
locations other than lua/
#]=======================================================================]
find_path(LUAJIT_INCLUDE_DIR lua.h
HINTS
ENV LUA_DIR
PATH_SUFFIXES include/luajit include/luajit-2.0 include/luajit-2.1 include
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
find_library(LUAJIT_LIBRARY
NAMES luajit51 luajit5.1 luajit-5.1 luajit lua51
HINTS
ENV LUA_DIR
PATH_SUFFIXES lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
)
if(LUAJIT_LIBRARY)
# include the math library for Unix
if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU)
find_library(LUAJIT_MATH_LIBRARY m)
set( LUAJIT_LIBRARIES "${LUAJIT_LIBRARY};${LUAJIT_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
# For Windows and Mac, don't need to explicitly include the math library
else()
set( LUAJIT_LIBRARIES "${LUAJIT_LIBRARY}" CACHE STRING "Lua Libraries")
endif()
endif()
if(LUAJIT_INCLUDE_DIR AND EXISTS "${LUAJIT_INCLUDE_DIR}/lua.h")
file(STRINGS "${LUAJIT_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUAJIT_VERSION_STRING "${lua_version_str}")
unset(lua_version_str)
endif()
include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
# handle the QUIETLY and REQUIRED arguments and set LUAJIT_FOUND to TRUE if
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJit
REQUIRED_VARS LUAJIT_LIBRARIES LUAJIT_INCLUDE_DIR
VERSION_VAR LUAJIT_VERSION_STRING)
mark_as_advanced(LUAJIT_INCLUDE_DIR LUAJIT_LIBRARIES LUAJIT_LIBRARY LUAJIT_MATH_LIBRARY)
+23 -2
View File
@@ -16,6 +16,7 @@ SET(common_sources
database_instances.cpp
dbcore.cpp
deity.cpp
dynamic_zone_base.cpp
emu_constants.cpp
emu_limits.cpp
emu_opcodes.cpp
@@ -31,6 +32,8 @@ SET(common_sources
eq_stream_proxy.cpp
eqtime.cpp
event_sub.cpp
expedition_base.cpp
expedition_lockout_timer.cpp
extprofile.cpp
faction.cpp
file_util.cpp
@@ -67,6 +70,7 @@ SET(common_sources
rulesys.cpp
say_link.cpp
serialize_buffer.cpp
server_event_scheduler.cpp
serverinfo.cpp
shareddb.cpp
skills.cpp
@@ -148,6 +152,7 @@ SET(repositories
repositories/base/base_character_currency_repository.h
repositories/base/base_character_data_repository.h
repositories/base/base_character_disciplines_repository.h
repositories/base/base_character_expedition_lockouts_repository.h
repositories/base/base_character_inspect_messages_repository.h
repositories/base/base_character_item_recast_repository.h
repositories/base/base_character_languages_repository.h
@@ -166,11 +171,16 @@ SET(repositories
repositories/base/base_char_recipe_list_repository.h
repositories/base/base_completed_tasks_repository.h
repositories/base/base_content_flags_repository.h
repositories/base/base_damageshieldtypes_repository.h
repositories/base/base_data_buckets_repository.h
repositories/base/base_db_str_repository.h
repositories/base/base_discovered_items_repository.h
repositories/base/base_doors_repository.h
repositories/base/base_dynamic_zones_repository.h
repositories/base/base_dynamic_zone_members_repository.h
repositories/base/base_eventlog_repository.h
repositories/base/base_expeditions_repository.h
repositories/base/base_expedition_lockouts_repository.h
repositories/base/base_faction_base_data_repository.h
repositories/base/base_faction_list_repository.h
repositories/base/base_faction_list_mod_repository.h
@@ -244,6 +254,7 @@ SET(repositories
repositories/base/base_rule_sets_repository.h
repositories/base/base_rule_values_repository.h
repositories/base/base_saylink_repository.h
repositories/base/base_server_scheduled_events_repository.h
repositories/base/base_skill_caps_repository.h
repositories/base/base_spawn2_repository.h
repositories/base/base_spawnentry_repository.h
@@ -267,7 +278,6 @@ SET(repositories
repositories/base/base_traps_repository.h
repositories/base/base_tributes_repository.h
repositories/base/base_tribute_levels_repository.h
repositories/base/base_variables_repository.h
repositories/base/base_veteran_reward_templates_repository.h
repositories/base/base_zone_repository.h
repositories/base/base_zone_points_repository.h
@@ -306,6 +316,7 @@ SET(repositories
repositories/character_currency_repository.h
repositories/character_data_repository.h
repositories/character_disciplines_repository.h
repositories/character_expedition_lockouts_repository.h
repositories/character_inspect_messages_repository.h
repositories/character_item_recast_repository.h
repositories/character_languages_repository.h
@@ -324,11 +335,16 @@ SET(repositories
repositories/char_recipe_list_repository.h
repositories/completed_tasks_repository.h
repositories/content_flags_repository.h
repositories/damageshieldtypes_repository.h
repositories/data_buckets_repository.h
repositories/db_str_repository.h
repositories/discovered_items_repository.h
repositories/doors_repository.h
repositories/dynamic_zones_repository.h
repositories/dynamic_zone_members_repository.h
repositories/eventlog_repository.h
repositories/expeditions_repository.h
repositories/expedition_lockouts_repository.h
repositories/faction_base_data_repository.h
repositories/faction_list_repository.h
repositories/faction_list_mod_repository.h
@@ -402,6 +418,7 @@ SET(repositories
repositories/rule_sets_repository.h
repositories/rule_values_repository.h
repositories/saylink_repository.h
repositories/server_scheduled_events_repository.h
repositories/skill_caps_repository.h
repositories/spawn2_repository.h
repositories/spawnentry_repository.h
@@ -425,7 +442,6 @@ SET(repositories
repositories/traps_repository.h
repositories/tributes_repository.h
repositories/tribute_levels_repository.h
repositories/variables_repository.h
repositories/veteran_reward_templates_repository.h
repositories/zone_repository.h
repositories/zone_points_repository.h
@@ -449,12 +465,14 @@ SET(common_headers
cli/argh.h
cli/eqemu_command_handler.h
cli/terminal_color.hpp
cron/croncpp.h
database/database_dump_service.h
data_verification.h
database.h
database_schema.h
dbcore.h
deity.h
dynamic_zone_base.h
emu_constants.h
emu_limits.h
emu_opcodes.h
@@ -478,6 +496,8 @@ SET(common_headers
eqtime.h
errmsg.h
event_sub.h
expedition_base.h
expedition_lockout_timer.h
extprofile.h
faction.h
file_util.h
@@ -529,6 +549,7 @@ SET(common_headers
say_link.h
seperator.h
serialize_buffer.h
server_event_scheduler.h
serverinfo.h
servertalk.h
shareddb.h
+19
View File
@@ -22,6 +22,7 @@
#include "../database.h"
#include "../rulesys.h"
#include "../eqemu_logsys.h"
#include "../repositories/content_flags_repository.h"
WorldContentService::WorldContentService()
@@ -99,3 +100,21 @@ bool WorldContentService::IsContentFlagEnabled(const std::string& content_flag)
return false;
}
void WorldContentService::ReloadContentFlags(Database &db)
{
std::vector<std::string> set_content_flags;
auto content_flags = ContentFlagsRepository::GetWhere(db, "enabled = 1");
set_content_flags.reserve(content_flags.size());
for (auto &flags: content_flags) {
set_content_flags.push_back(flags.flag_name);
}
LogInfo(
"Enabled content flags [{}]",
implode(", ", set_content_flags)
);
SetContentFlags(set_content_flags);
}
+3
View File
@@ -24,6 +24,8 @@
#include <string>
#include <vector>
class Database;
namespace Expansion {
static const int EXPANSION_ALL = -1;
static const int EXPANSION_FILTER_MAX = 99;
@@ -165,6 +167,7 @@ public:
const std::vector<std::string> &GetContentFlags() const;
bool IsContentFlagEnabled(const std::string& content_flag);
void SetContentFlags(std::vector<std::string> content_flags);
void ReloadContentFlags(Database &db);
void SetExpansionContext();
};
+876
View File
@@ -0,0 +1,876 @@
#pragma once
#include <vector>
#include <string>
#include <sstream>
#include <bitset>
#include <cctype>
#include <ctime>
#include <iomanip>
#include <algorithm>
#if __cplusplus > 201402L
#include <string_view>
#define CRONCPP_IS_CPP17
#endif
namespace cron
{
#ifdef CRONCPP_IS_CPP17
#define HAS_STRING_VIEW
#define STRING_VIEW std::string_view
#define STRING_VIEW_NPOS std::string_view::npos
#define CONSTEXPTR constexpr
#else
#define STRING_VIEW std::string const &
#define STRING_VIEW_NPOS std::string::npos
#define CONSTEXPTR
#endif
using cron_int = uint8_t;
constexpr std::time_t INVALID_TIME = static_cast<std::time_t>(-1);
constexpr size_t INVALID_CRON_INDEX = static_cast<size_t>(-1);
class cronexpr;
namespace detail
{
enum class cron_field
{
second,
minute,
hour_of_day,
day_of_week,
day_of_month,
month,
year
};
template <typename Traits>
static bool find_next(cronexpr const & cex,
std::tm& date,
size_t const dot);
}
struct bad_cronexpr : public std::runtime_error
{
public:
explicit bad_cronexpr(STRING_VIEW message) :
std::runtime_error(message.data())
{}
};
struct cron_standard_traits
{
static const cron_int CRON_MIN_SECONDS = 0;
static const cron_int CRON_MAX_SECONDS = 59;
static const cron_int CRON_MIN_MINUTES = 0;
static const cron_int CRON_MAX_MINUTES = 59;
static const cron_int CRON_MIN_HOURS = 0;
static const cron_int CRON_MAX_HOURS = 23;
static const cron_int CRON_MIN_DAYS_OF_WEEK = 0;
static const cron_int CRON_MAX_DAYS_OF_WEEK = 6;
static const cron_int CRON_MIN_DAYS_OF_MONTH = 1;
static const cron_int CRON_MAX_DAYS_OF_MONTH = 31;
static const cron_int CRON_MIN_MONTHS = 1;
static const cron_int CRON_MAX_MONTHS = 12;
static const cron_int CRON_MAX_YEARS_DIFF = 4;
#ifdef CRONCPP_IS_CPP17
static const inline std::vector<std::string> DAYS = { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
static const inline std::vector<std::string> MONTHS = { "NIL", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
#else
static std::vector<std::string>& DAYS()
{
static std::vector<std::string> days = { "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
return days;
}
static std::vector<std::string>& MONTHS()
{
static std::vector<std::string> months = { "NIL", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
return months;
}
#endif
};
struct cron_oracle_traits
{
static const cron_int CRON_MIN_SECONDS = 0;
static const cron_int CRON_MAX_SECONDS = 59;
static const cron_int CRON_MIN_MINUTES = 0;
static const cron_int CRON_MAX_MINUTES = 59;
static const cron_int CRON_MIN_HOURS = 0;
static const cron_int CRON_MAX_HOURS = 23;
static const cron_int CRON_MIN_DAYS_OF_WEEK = 1;
static const cron_int CRON_MAX_DAYS_OF_WEEK = 7;
static const cron_int CRON_MIN_DAYS_OF_MONTH = 1;
static const cron_int CRON_MAX_DAYS_OF_MONTH = 31;
static const cron_int CRON_MIN_MONTHS = 0;
static const cron_int CRON_MAX_MONTHS = 11;
static const cron_int CRON_MAX_YEARS_DIFF = 4;
#ifdef CRONCPP_IS_CPP17
static const inline std::vector<std::string> DAYS = { "NIL", "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
static const inline std::vector<std::string> MONTHS = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
#else
static std::vector<std::string>& DAYS()
{
static std::vector<std::string> days = { "NIL", "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
return days;
}
static std::vector<std::string>& MONTHS()
{
static std::vector<std::string> months = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
return months;
}
#endif
};
struct cron_quartz_traits
{
static const cron_int CRON_MIN_SECONDS = 0;
static const cron_int CRON_MAX_SECONDS = 59;
static const cron_int CRON_MIN_MINUTES = 0;
static const cron_int CRON_MAX_MINUTES = 59;
static const cron_int CRON_MIN_HOURS = 0;
static const cron_int CRON_MAX_HOURS = 23;
static const cron_int CRON_MIN_DAYS_OF_WEEK = 1;
static const cron_int CRON_MAX_DAYS_OF_WEEK = 7;
static const cron_int CRON_MIN_DAYS_OF_MONTH = 1;
static const cron_int CRON_MAX_DAYS_OF_MONTH = 31;
static const cron_int CRON_MIN_MONTHS = 1;
static const cron_int CRON_MAX_MONTHS = 12;
static const cron_int CRON_MAX_YEARS_DIFF = 4;
#ifdef CRONCPP_IS_CPP17
static const inline std::vector<std::string> DAYS = { "NIL", "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
static const inline std::vector<std::string> MONTHS = { "NIL", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
#else
static std::vector<std::string>& DAYS()
{
static std::vector<std::string> days = { "NIL", "SUN", "MON", "TUE", "WED", "THU", "FRI", "SAT" };
return days;
}
static std::vector<std::string>& MONTHS()
{
static std::vector<std::string> months = { "NIL", "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV", "DEC" };
return months;
}
#endif
};
class cronexpr;
template <typename Traits = cron_standard_traits>
static cronexpr make_cron(STRING_VIEW expr);
class cronexpr
{
std::bitset<60> seconds;
std::bitset<60> minutes;
std::bitset<24> hours;
std::bitset<7> days_of_week;
std::bitset<31> days_of_month;
std::bitset<12> months;
friend bool operator==(cronexpr const & e1, cronexpr const & e2);
friend bool operator!=(cronexpr const & e1, cronexpr const & e2);
template <typename Traits>
friend bool detail::find_next(cronexpr const & cex,
std::tm& date,
size_t const dot);
friend std::string to_string(cronexpr const & cex);
template <typename Traits>
friend cronexpr make_cron(STRING_VIEW expr);
};
inline bool operator==(cronexpr const & e1, cronexpr const & e2)
{
return
e1.seconds == e2.seconds &&
e1.minutes == e2.minutes &&
e1.hours == e2.hours &&
e1.days_of_week == e2.days_of_week &&
e1.days_of_month == e2.days_of_month &&
e1.months == e2.months;
}
inline bool operator!=(cronexpr const & e1, cronexpr const & e2)
{
return !(e1 == e2);
}
inline std::string to_string(cronexpr const & cex)
{
return
cex.seconds.to_string() + " " +
cex.minutes.to_string() + " " +
cex.hours.to_string() + " " +
cex.days_of_month.to_string() + " " +
cex.months.to_string() + " " +
cex.days_of_week.to_string();
}
namespace utils
{
inline std::time_t tm_to_time(std::tm& date)
{
return std::mktime(&date);
}
inline std::tm* time_to_tm(std::time_t const * date, std::tm* const out)
{
#ifdef _WIN32
errno_t err = localtime_s(out, date);
return 0 == err ? out : nullptr;
#else
return localtime_r(date, out);
#endif
}
inline std::tm to_tm(STRING_VIEW time)
{
std::istringstream str(time.data());
str.imbue(std::locale(setlocale(LC_ALL, nullptr)));
std::tm result;
str >> std::get_time(&result, "%Y-%m-%d %H:%M:%S");
if (str.fail()) throw std::runtime_error("Parsing date failed!");
result.tm_isdst = -1; // DST info not available
return result;
}
inline std::string to_string(std::tm const & tm)
{
std::ostringstream str;
str.imbue(std::locale(setlocale(LC_ALL, nullptr)));
str << std::put_time(&tm, "%Y-%m-%d %H:%M:%S");
if (str.fail()) throw std::runtime_error("Writing date failed!");
return str.str();
}
inline std::string to_upper(std::string text)
{
std::transform(std::begin(text), std::end(text),
std::begin(text), static_cast<int(*)(int)>(std::toupper));
return text;
}
static std::vector<std::string> split(STRING_VIEW text, char const delimiter)
{
std::vector<std::string> tokens;
std::string token;
std::istringstream tokenStream(text.data());
while (std::getline(tokenStream, token, delimiter))
{
tokens.push_back(token);
}
return tokens;
}
CONSTEXPTR inline bool contains(STRING_VIEW text, char const ch) noexcept
{
return STRING_VIEW_NPOS != text.find_first_of(ch);
}
}
namespace detail
{
inline cron_int to_cron_int(STRING_VIEW text)
{
try
{
return static_cast<cron_int>(std::stoul(text.data()));
}
catch (std::exception const & ex)
{
throw bad_cronexpr(ex.what());
}
}
static std::string replace_ordinals(
std::string text,
std::vector<std::string> const & replacement)
{
for (size_t i = 0; i < replacement.size(); ++i)
{
auto pos = text.find(replacement[i]);
if (std::string::npos != pos)
text.replace(pos, 3 ,std::to_string(i));
}
return text;
}
static std::pair<cron_int, cron_int> make_range(
STRING_VIEW field,
cron_int const minval,
cron_int const maxval)
{
cron_int first = 0;
cron_int last = 0;
if (field.size() == 1 && field[0] == '*')
{
first = minval;
last = maxval;
}
else if (!utils::contains(field, '-'))
{
first = to_cron_int(field);
last = first;
}
else
{
auto parts = utils::split(field, '-');
if (parts.size() != 2)
throw bad_cronexpr("Specified range requires two fields");
first = to_cron_int(parts[0]);
last = to_cron_int(parts[1]);
}
if (first > maxval || last > maxval)
{
throw bad_cronexpr("Specified range exceeds maximum");
}
if (first < minval || last < minval)
{
throw bad_cronexpr("Specified range is less than minimum");
}
if (first > last)
{
throw bad_cronexpr("Specified range start exceeds range end");
}
return { first, last };
}
template <size_t N>
static void set_cron_field(
STRING_VIEW value,
std::bitset<N>& target,
cron_int const minval,
cron_int const maxval)
{
if(value.length() > 0 && value[value.length()-1] == ',')
throw bad_cronexpr("Value cannot end with comma");
auto fields = utils::split(value, ',');
if (fields.empty())
throw bad_cronexpr("Expression parsing error");
for (auto const & field : fields)
{
if (!utils::contains(field, '/'))
{
#ifdef CRONCPP_IS_CPP17
auto[first, last] = detail::make_range(field, minval, maxval);
#else
auto range = detail::make_range(field, minval, maxval);
auto first = range.first;
auto last = range.second;
#endif
for (cron_int i = first - minval; i <= last - minval; ++i)
{
target.set(i);
}
}
else
{
auto parts = utils::split(field, '/');
if (parts.size() != 2)
throw bad_cronexpr("Incrementer must have two fields");
#ifdef CRONCPP_IS_CPP17
auto[first, last] = detail::make_range(parts[0], minval, maxval);
#else
auto range = detail::make_range(parts[0], minval, maxval);
auto first = range.first;
auto last = range.second;
#endif
if (!utils::contains(parts[0], '-'))
{
last = maxval;
}
auto delta = detail::to_cron_int(parts[1]);
if(delta <= 0)
throw bad_cronexpr("Incrementer must be a positive value");
for (cron_int i = first - minval; i <= last - minval; i += delta)
{
target.set(i);
}
}
}
}
template <typename Traits>
static void set_cron_days_of_week(
std::string value,
std::bitset<7>& target)
{
auto days = utils::to_upper(value);
auto days_replaced = detail::replace_ordinals(
days,
#ifdef CRONCPP_IS_CPP17
Traits::DAYS
#else
Traits::DAYS()
#endif
);
if (days_replaced.size() == 1 && days_replaced[0] == '?')
days_replaced[0] = '*';
set_cron_field(
days_replaced,
target,
Traits::CRON_MIN_DAYS_OF_WEEK,
Traits::CRON_MAX_DAYS_OF_WEEK);
}
template <typename Traits>
static void set_cron_days_of_month(
std::string value,
std::bitset<31>& target)
{
if (value.size() == 1 && value[0] == '?')
value[0] = '*';
set_cron_field(
value,
target,
Traits::CRON_MIN_DAYS_OF_MONTH,
Traits::CRON_MAX_DAYS_OF_MONTH);
}
template <typename Traits>
static void set_cron_month(
std::string value,
std::bitset<12>& target)
{
auto month = utils::to_upper(value);
auto month_replaced = replace_ordinals(
month,
#ifdef CRONCPP_IS_CPP17
Traits::MONTHS
#else
Traits::MONTHS()
#endif
);
set_cron_field(
month_replaced,
target,
Traits::CRON_MIN_MONTHS,
Traits::CRON_MAX_MONTHS);
}
template <size_t N>
inline size_t next_set_bit(
std::bitset<N> const & target,
size_t /*minimum*/,
size_t /*maximum*/,
size_t offset)
{
for (auto i = offset; i < N; ++i)
{
if (target.test(i)) return i;
}
return INVALID_CRON_INDEX;
}
inline void add_to_field(
std::tm& date,
cron_field const field,
int const val)
{
switch (field)
{
case cron_field::second:
date.tm_sec += val;
break;
case cron_field::minute:
date.tm_min += val;
break;
case cron_field::hour_of_day:
date.tm_hour += val;
break;
case cron_field::day_of_week:
case cron_field::day_of_month:
date.tm_mday += val;
break;
case cron_field::month:
date.tm_mon += val;
break;
case cron_field::year:
date.tm_year += val;
break;
}
if (INVALID_TIME == utils::tm_to_time(date))
throw bad_cronexpr("Invalid time expression");
}
inline void set_field(
std::tm& date,
cron_field const field,
int const val)
{
switch (field)
{
case cron_field::second:
date.tm_sec = val;
break;
case cron_field::minute:
date.tm_min = val;
break;
case cron_field::hour_of_day:
date.tm_hour = val;
break;
case cron_field::day_of_week:
date.tm_wday = val;
break;
case cron_field::day_of_month:
date.tm_mday = val;
break;
case cron_field::month:
date.tm_mon = val;
break;
case cron_field::year:
date.tm_year = val;
break;
}
if (INVALID_TIME == utils::tm_to_time(date))
throw bad_cronexpr("Invalid time expression");
}
inline void reset_field(
std::tm& date,
cron_field const field)
{
switch (field)
{
case cron_field::second:
date.tm_sec = 0;
break;
case cron_field::minute:
date.tm_min = 0;
break;
case cron_field::hour_of_day:
date.tm_hour = 0;
break;
case cron_field::day_of_week:
date.tm_wday = 0;
break;
case cron_field::day_of_month:
date.tm_mday = 1;
break;
case cron_field::month:
date.tm_mon = 0;
break;
case cron_field::year:
date.tm_year = 0;
break;
}
if (INVALID_TIME == utils::tm_to_time(date))
throw bad_cronexpr("Invalid time expression");
}
inline void reset_all_fields(
std::tm& date,
std::bitset<7> const & marked_fields)
{
for (size_t i = 0; i < marked_fields.size(); ++i)
{
if (marked_fields.test(i))
reset_field(date, static_cast<cron_field>(i));
}
}
inline void mark_field(
std::bitset<7> & orders,
cron_field const field)
{
if (!orders.test(static_cast<size_t>(field)))
orders.set(static_cast<size_t>(field));
}
template <size_t N>
static size_t find_next(
std::bitset<N> const & target,
std::tm& date,
unsigned int const minimum,
unsigned int const maximum,
unsigned int const value,
cron_field const field,
cron_field const next_field,
std::bitset<7> const & marked_fields)
{
auto next_value = next_set_bit(target, minimum, maximum, value);
if (INVALID_CRON_INDEX == next_value)
{
add_to_field(date, next_field, 1);
reset_field(date, field);
next_value = next_set_bit(target, minimum, maximum, 0);
}
if (INVALID_CRON_INDEX == next_value || next_value != value)
{
set_field(date, field, static_cast<int>(next_value));
reset_all_fields(date, marked_fields);
}
return next_value;
}
template <typename Traits>
static size_t find_next_day(
std::tm& date,
std::bitset<31> const & days_of_month,
size_t day_of_month,
std::bitset<7> const & days_of_week,
size_t day_of_week,
std::bitset<7> const & marked_fields)
{
unsigned int count = 0;
unsigned int maximum = 366;
while (
(!days_of_month.test(day_of_month - Traits::CRON_MIN_DAYS_OF_MONTH) ||
!days_of_week.test(day_of_week - Traits::CRON_MIN_DAYS_OF_WEEK))
&& count++ < maximum)
{
add_to_field(date, cron_field::day_of_month, 1);
day_of_month = date.tm_mday;
day_of_week = date.tm_wday;
reset_all_fields(date, marked_fields);
}
return day_of_month;
}
template <typename Traits>
static bool find_next(cronexpr const & cex,
std::tm& date,
size_t const dot)
{
bool res = true;
std::bitset<7> marked_fields{ 0 };
std::bitset<7> empty_list{ 0 };
unsigned int second = date.tm_sec;
auto updated_second = find_next(
cex.seconds,
date,
Traits::CRON_MIN_SECONDS,
Traits::CRON_MAX_SECONDS,
second,
cron_field::second,
cron_field::minute,
empty_list);
if (second == updated_second)
{
mark_field(marked_fields, cron_field::second);
}
unsigned int minute = date.tm_min;
auto update_minute = find_next(
cex.minutes,
date,
Traits::CRON_MIN_MINUTES,
Traits::CRON_MAX_MINUTES,
minute,
cron_field::minute,
cron_field::hour_of_day,
marked_fields);
if (minute == update_minute)
{
mark_field(marked_fields, cron_field::minute);
}
else
{
res = find_next<Traits>(cex, date, dot);
if (!res) return res;
}
unsigned int hour = date.tm_hour;
auto updated_hour = find_next(
cex.hours,
date,
Traits::CRON_MIN_HOURS,
Traits::CRON_MAX_HOURS,
hour,
cron_field::hour_of_day,
cron_field::day_of_week,
marked_fields);
if (hour == updated_hour)
{
mark_field(marked_fields, cron_field::hour_of_day);
}
else
{
res = find_next<Traits>(cex, date, dot);
if (!res) return res;
}
unsigned int day_of_week = date.tm_wday;
unsigned int day_of_month = date.tm_mday;
auto updated_day_of_month = find_next_day<Traits>(
date,
cex.days_of_month,
day_of_month,
cex.days_of_week,
day_of_week,
marked_fields);
if (day_of_month == updated_day_of_month)
{
mark_field(marked_fields, cron_field::day_of_month);
}
else
{
res = find_next<Traits>(cex, date, dot);
if (!res) return res;
}
unsigned int month = date.tm_mon;
auto updated_month = find_next(
cex.months,
date,
Traits::CRON_MIN_MONTHS,
Traits::CRON_MAX_MONTHS,
month,
cron_field::month,
cron_field::year,
marked_fields);
if (month != updated_month)
{
if (date.tm_year - dot > Traits::CRON_MAX_YEARS_DIFF)
return false;
res = find_next<Traits>(cex, date, dot);
if (!res) return res;
}
return res;
}
}
template <typename Traits>
static cronexpr make_cron(STRING_VIEW expr)
{
cronexpr cex;
if (expr.empty())
throw bad_cronexpr("Invalid empty cron expression");
auto fields = utils::split(expr, ' ');
fields.erase(
std::remove_if(std::begin(fields), std::end(fields),
[](STRING_VIEW s) {return s.empty(); }),
std::end(fields));
if (fields.size() != 6)
throw bad_cronexpr("cron expression must have six fields");
detail::set_cron_field(fields[0], cex.seconds, Traits::CRON_MIN_SECONDS, Traits::CRON_MAX_SECONDS);
detail::set_cron_field(fields[1], cex.minutes, Traits::CRON_MIN_MINUTES, Traits::CRON_MAX_MINUTES);
detail::set_cron_field(fields[2], cex.hours, Traits::CRON_MIN_HOURS, Traits::CRON_MAX_HOURS);
detail::set_cron_days_of_week<Traits>(fields[5], cex.days_of_week);
detail::set_cron_days_of_month<Traits>(fields[3], cex.days_of_month);
detail::set_cron_month<Traits>(fields[4], cex.months);
return cex;
}
template <typename Traits = cron_standard_traits>
static std::tm cron_next(cronexpr const & cex, std::tm date)
{
time_t original = utils::tm_to_time(date);
if (INVALID_TIME == original) return {};
if (!detail::find_next<Traits>(cex, date, date.tm_year))
return {};
time_t calculated = utils::tm_to_time(date);
if (INVALID_TIME == calculated) return {};
if (calculated == original)
{
add_to_field(date, detail::cron_field::second, 1);
if (!detail::find_next<Traits>(cex, date, date.tm_year))
return {};
}
return date;
}
template <typename Traits = cron_standard_traits>
static std::time_t cron_next(cronexpr const & cex, std::time_t const & date)
{
std::tm val;
std::tm* dt = utils::time_to_tm(&date, &val);
if (dt == nullptr) return INVALID_TIME;
time_t original = utils::tm_to_time(*dt);
if (INVALID_TIME == original) return INVALID_TIME;
if(!detail::find_next<Traits>(cex, *dt, dt->tm_year))
return INVALID_TIME;
time_t calculated = utils::tm_to_time(*dt);
if (INVALID_TIME == calculated) return calculated;
if (calculated == original)
{
add_to_field(*dt, detail::cron_field::second, 1);
if(!detail::find_next<Traits>(cex, *dt, dt->tm_year))
return INVALID_TIME;
}
return utils::tm_to_time(*dt);
}
}
+76 -26
View File
@@ -703,11 +703,11 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
"(%u, %u, %u, %f, %f, %f, %f, %i), "
"(%u, %u, %u, %f, %f, %f, %f, %i), "
"(%u, %u, %u, %f, %f, %f, %f, %i)",
character_id, pp->binds[0].zoneId, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading, 0,
character_id, pp->binds[1].zoneId, 0, pp->binds[1].x, pp->binds[1].y, pp->binds[1].z, pp->binds[1].heading, 1,
character_id, pp->binds[2].zoneId, 0, pp->binds[2].x, pp->binds[2].y, pp->binds[2].z, pp->binds[2].heading, 2,
character_id, pp->binds[3].zoneId, 0, pp->binds[3].x, pp->binds[3].y, pp->binds[3].z, pp->binds[3].heading, 3,
character_id, pp->binds[4].zoneId, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading, 4
character_id, pp->binds[0].zone_id, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading, 0,
character_id, pp->binds[1].zone_id, 0, pp->binds[1].x, pp->binds[1].y, pp->binds[1].z, pp->binds[1].heading, 1,
character_id, pp->binds[2].zone_id, 0, pp->binds[2].x, pp->binds[2].y, pp->binds[2].z, pp->binds[2].heading, 2,
character_id, pp->binds[3].zone_id, 0, pp->binds[3].x, pp->binds[3].y, pp->binds[3].z, pp->binds[3].heading, 3,
character_id, pp->binds[4].zone_id, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading, 4
); results = QueryDatabase(query);
/* HoTT Ability */
@@ -870,36 +870,40 @@ void Database::GetCharName(uint32 char_id, char* name) {
}
}
const char* Database::GetCharNameByID(uint32 char_id) {
std::string Database::GetCharNameByID(uint32 char_id) {
std::string query = fmt::format("SELECT `name` FROM `character_data` WHERE id = {}", char_id);
auto results = QueryDatabase(query);
std::string res;
if (!results.Success()) {
return "";
return res;
}
if (results.RowCount() == 0) {
return "";
return res;
}
auto row = results.begin();
return row[0];
res = row[0];
return res;
}
const char* Database::GetNPCNameByID(uint32 npc_id) {
std::string Database::GetNPCNameByID(uint32 npc_id) {
std::string query = fmt::format("SELECT `name` FROM `npc_types` WHERE id = {}", npc_id);
auto results = QueryDatabase(query);
std::string res;
if (!results.Success()) {
return "";
return res;
}
if (results.RowCount() == 0) {
return "";
return res;
}
auto row = results.begin();
return row[0];
res = row[0];
return res;
}
bool Database::LoadVariables() {
@@ -971,10 +975,24 @@ bool Database::SetVariable(const std::string varname, const std::string &varvalu
}
// Get zone starting points from DB
bool Database::GetSafePoints(const char* short_name, uint32 version, float* safe_x, float* safe_y, float* safe_z, int16* minstatus, uint8* minlevel, char *flag_needed) {
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) {
std::string query = StringFormat("SELECT safe_x, safe_y, safe_z, min_status, min_level, flag_needed FROM zone "
" WHERE short_name='%s' AND (version=%i OR version=0) ORDER BY version DESC", short_name, version);
if (zone_short_name == nullptr)
return false;
std::string query = fmt::format(
SQL(
SELECT
`safe_x`, `safe_y`, `safe_z`, `safe_heading`, `min_status`, `min_level`, `flag_needed`
FROM
zone
WHERE
`short_name` = '{}'
AND
(`version` = {} OR `version` = 0)
ORDER BY `version` DESC
), zone_short_name, instance_version
);
auto results = QueryDatabase(query);
if (!results.Success())
@@ -987,16 +1005,24 @@ bool Database::GetSafePoints(const char* short_name, uint32 version, float* safe
if (safe_x != nullptr)
*safe_x = atof(row[0]);
if (safe_y != nullptr)
*safe_y = atof(row[1]);
if (safe_z != nullptr)
*safe_z = atof(row[2]);
if (minstatus != nullptr)
*minstatus = atoi(row[3]);
if (minlevel != nullptr)
*minlevel = atoi(row[4]);
if (safe_heading != nullptr)
*safe_heading = atof(row[3]);
if (min_status != nullptr)
*min_status = atoi(row[4]);
if (min_level != nullptr)
*min_level = atoi(row[5]);
if (flag_needed != nullptr)
strcpy(flag_needed, row[5]);
strcpy(flag_needed, row[6]);
return true;
}
@@ -1356,6 +1382,20 @@ bool Database::SetMQDetectionFlag(const char* accountname, const char* character
return results.RowsAffected() != 0;
}
bool Database::SetMQDetectionFlag(const char* accountname, const char* charactername, const std::string &hacked, const char* zone) {
//Utilize the "hacker" table, but also give zone information.
auto query = fmt::format("INSERT INTO hackers(account, name, hacked, zone) values('{}', '{}', '{}', '{}')",
accountname, charactername, hacked, zone);
auto results = QueryDatabase(query);
if (!results.Success())
{
return false;
}
return results.RowsAffected() != 0;
}
uint8 Database::GetRaceSkill(uint8 skillid, uint8 in_race)
{
uint16 race_cap = 0;
@@ -1979,7 +2019,7 @@ void Database::ClearRaidLeader(uint32 gid, uint32 rid)
QueryDatabase(query);
}
void Database::UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win)
void Database::UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win, bool remove)
{
std::string field;
@@ -2017,16 +2057,26 @@ void Database::UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win)
}
}
if (win)
if (win) {
field += "wins";
else
} else {
field += "losses";
}
std::string query = StringFormat("UPDATE `adventure_stats` SET %s=%s+1 WHERE player_id=%u",field.c_str(), field.c_str(), char_id);
std::string modification;
if (remove){
modification = "-1";
} else {
modification = "+1";
}
std::string query = StringFormat("UPDATE `adventure_stats` SET %s=%s%s WHERE player_id=%u",field.c_str(), field.c_str(), modification.c_str(), char_id);
auto results = QueryDatabase(query);
if (results.RowsAffected() != 0)
if (results.RowsAffected() != 0) {
return;
}
query = StringFormat("INSERT INTO `adventure_stats` SET %s=1, player_id=%u", field.c_str(), char_id);
QueryDatabase(query);
+5 -22
View File
@@ -45,24 +45,6 @@ namespace EQ
class InventoryProfile;
}
struct EventLogDetails_Struct {
uint32 id;
char accountname[64];
uint32 account_id;
int16 status;
char charactername[64];
char targetname[64];
char timestamp[64];
char descriptiontype[64];
char details[128];
};
struct CharacterEventLog_Struct {
uint32 count;
uint8 eventid;
EventLogDetails_Struct eld[255];
};
struct npcDecayTimes_Struct {
uint16 minlvl;
uint16 maxlvl;
@@ -128,6 +110,7 @@ public:
bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct *pp);
bool SetHackerFlag(const char *accountname, const char *charactername, const char *hacked);
bool SetMQDetectionFlag(const char *accountname, const char *charactername, const char *hacked, const char *zone);
bool SetMQDetectionFlag(const char *accountname, const char *charactername, const std::string &hacked, const char *zone);
bool UpdateName(const char *oldname, const char *newname);
bool CopyCharacter(
std::string source_character_name,
@@ -155,8 +138,8 @@ public:
void GetAccountName(uint32 accountid, char* name, uint32* oLSAccountID = 0);
void GetCharName(uint32 char_id, char* name);
const char *GetCharNameByID(uint32 char_id);
const char *GetNPCNameByID(uint32 npc_id);
std::string GetCharNameByID(uint32 char_id);
std::string GetNPCNameByID(uint32 npc_id);
void LoginIP(uint32 AccountID, const char* LoginIP);
/* Instancing */
@@ -191,7 +174,7 @@ public:
/* Adventure related. */
void UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win);
void UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win, bool remove = false);
bool GetAdventureStats(uint32 char_id, AdventureStats_Struct *as);
/* Account Related */
@@ -259,7 +242,7 @@ public:
/* General Queries */
bool GetSafePoints(const char* short_name, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr);
bool GetSafePoints(const char* zone_short_name, uint32 instance_version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, float* safe_heading = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr);
bool GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zoneid = 0, float* graveyard_x = 0, float* graveyard_y = 0, float* graveyard_z = 0, float* graveyard_heading = 0);
bool GetZoneLongName(const char* short_name, char** long_name, char* file_name = 0, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, uint32* graveyard_id = 0, uint32* maxclients = 0);
bool LoadPTimers(uint32 charid, PTimerList &into);
+1 -2
View File
@@ -300,8 +300,7 @@ void DatabaseDumpService::Dump()
config->DatabaseUsername
);
std::string options = "--allow-keywords --extended-insert";
std::string options = "--allow-keywords --extended-insert --max-allowed-packet=1G --net-buffer-length=32704";
if (IsDumpWithNoData()) {
options += " --no-data";
}
+5 -5
View File
@@ -48,7 +48,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
namespace Convert {
struct BindStruct {
/*000*/ uint32 zoneId;
/*000*/ uint32 zone_id;
/*004*/ float x;
/*008*/ float y;
/*012*/ float z;
@@ -1320,18 +1320,18 @@ bool Database::CheckDatabaseConvertPPDeblob(){
if (rquery != ""){ results = QueryDatabase(rquery); }
/* Run Bind Home Convert */
if (pp->binds[4].zoneId < 999 && !_ISNAN_(pp->binds[4].x) && !_ISNAN_(pp->binds[4].y) && !_ISNAN_(pp->binds[4].z) && !_ISNAN_(pp->binds[4].heading)) {
if (pp->binds[4].zone_id < 999 && !_ISNAN_(pp->binds[4].x) && !_ISNAN_(pp->binds[4].y) && !_ISNAN_(pp->binds[4].z) && !_ISNAN_(pp->binds[4].heading)) {
rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
" VALUES (%u, %u, %u, %f, %f, %f, %f, 1)",
character_id, pp->binds[4].zoneId, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading);
character_id, pp->binds[4].zone_id, 0, pp->binds[4].x, pp->binds[4].y, pp->binds[4].z, pp->binds[4].heading);
if (rquery != ""){ results = QueryDatabase(rquery); }
}
/* Run Bind Convert */
if (pp->binds[0].zoneId < 999 && !_ISNAN_(pp->binds[0].x) && !_ISNAN_(pp->binds[0].y) && !_ISNAN_(pp->binds[0].z) && !_ISNAN_(pp->binds[0].heading)) {
if (pp->binds[0].zone_id < 999 && !_ISNAN_(pp->binds[0].x) && !_ISNAN_(pp->binds[0].y) && !_ISNAN_(pp->binds[0].z) && !_ISNAN_(pp->binds[0].heading)) {
rquery = StringFormat("REPLACE INTO `character_bind` (id, zone_id, instance_id, x, y, z, heading, is_home)"
" VALUES (%u, %u, %u, %f, %f, %f, %f, 0)",
character_id, pp->binds[0].zoneId, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading);
character_id, pp->binds[0].zone_id, 0, pp->binds[0].x, pp->binds[0].y, pp->binds[0].z, pp->binds[0].heading);
if (rquery != ""){ results = QueryDatabase(rquery); }
}
/* Run Language Convert */
+7 -4
View File
@@ -20,6 +20,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "../common/rulesys.h"
#include "../common/string_util.h"
#include "../common/timer.h"
#include "../common/repositories/dynamic_zone_members_repository.h"
#include "../common/repositories/dynamic_zones_repository.h"
#include "database.h"
@@ -493,8 +495,8 @@ void Database::DeleteInstance(uint16 instance_id)
query = StringFormat("DELETE FROM spawn_condition_values WHERE instance_id=%u", instance_id);
QueryDatabase(query);
query = fmt::format("DELETE FROM dynamic_zones WHERE instance_id={}", instance_id);
QueryDatabase(query);
DynamicZoneMembersRepository::DeleteByInstance(*this, instance_id);
DynamicZonesRepository::DeleteWhere(*this, fmt::format("instance_id = {}", instance_id));
BuryCorpsesInInstance(instance_id);
}
@@ -507,7 +509,7 @@ void Database::FlagInstanceByGroupLeader(uint32 zone, int16 version, uint32 char
char ln[128];
memset(ln, 0, 128);
strcpy(ln, GetGroupLeadershipInfo(gid, ln));
GetGroupLeadershipInfo(gid, ln);
uint32 l_charid = GetCharacterID((const char*)ln);
uint16 l_id = GetInstanceID(zone, l_charid, version);
@@ -585,7 +587,8 @@ void Database::PurgeExpiredInstances()
QueryDatabase(fmt::format("DELETE FROM respawn_times WHERE instance_id IN ({})", imploded_instance_ids));
QueryDatabase(fmt::format("DELETE FROM spawn_condition_values WHERE instance_id IN ({})", imploded_instance_ids));
QueryDatabase(fmt::format("UPDATE character_corpses SET is_buried = 1, instance_id = 0 WHERE instance_id IN ({})", imploded_instance_ids));
QueryDatabase(fmt::format("DELETE FROM dynamic_zones WHERE instance_id IN ({})", imploded_instance_ids));
DynamicZoneMembersRepository::DeleteByManyInstances(*this, imploded_instance_ids);
DynamicZonesRepository::DeleteWhere(*this, fmt::format("instance_id IN ({})", imploded_instance_ids));
}
void Database::SetInstanceDuration(uint16 instance_id, uint32 new_duration)
+4 -2
View File
@@ -51,6 +51,7 @@ namespace DatabaseSchema {
{"character_disciplines", "id"},
{"character_enabledtasks", "charid"},
{"character_expedition_lockouts", "character_id"},
{"character_exp_modifiers", "character_id"},
{"character_inspect_messages", "id"},
{"character_item_recast", "id"},
{"character_languages", "id"},
@@ -116,6 +117,7 @@ namespace DatabaseSchema {
"character_disciplines",
"character_enabledtasks",
"character_expedition_lockouts",
"character_exp_modifiers",
"character_inspect_messages",
"character_item_recast",
"character_languages",
@@ -307,10 +309,10 @@ namespace DatabaseSchema {
"banned_ips",
"bug_reports",
"bugs",
"dynamic_zone_members",
"dynamic_zones",
"eventlog",
"expedition_lockouts",
"expedition_members",
"expeditions",
"gm_ips",
"group_id",
@@ -328,7 +330,7 @@ namespace DatabaseSchema {
"reports",
"respawn_times",
"saylink",
"server_scheduled_events",
};
}
+4 -4
View File
@@ -223,10 +223,10 @@ bool DBcore::Open(
)
{
LockMutex lock(&MDatabase);
safe_delete(pHost);
safe_delete(pUser);
safe_delete(pPassword);
safe_delete(pDatabase);
safe_delete_array(pHost);
safe_delete_array(pUser);
safe_delete_array(pPassword);
safe_delete_array(pDatabase);
pHost = strcpy(new char[strlen(iHost) + 1], iHost);
pUser = strcpy(new char[strlen(iUser) + 1], iUser);
pPassword = strcpy(new char[strlen(iPassword) + 1], iPassword);
+430
View File
@@ -0,0 +1,430 @@
#include "dynamic_zone_base.h"
#include "database.h"
#include "eqemu_logsys.h"
#include "repositories/instance_list_repository.h"
#include "repositories/instance_list_player_repository.h"
#include "rulesys.h"
#include "servertalk.h"
DynamicZoneBase::DynamicZoneBase(DynamicZonesRepository::DynamicZoneInstance&& entry)
{
LoadRepositoryResult(std::move(entry));
}
uint32_t DynamicZoneBase::Create()
{
if (m_id != 0)
{
return m_id;
}
if (GetInstanceID() == 0)
{
CreateInstance();
}
m_id = SaveToDatabase();
return m_id;
}
uint32_t DynamicZoneBase::CreateInstance()
{
if (m_instance_id)
{
LogDynamicZones("CreateInstance failed, instance id [{}] already created", m_instance_id);
return 0;
}
if (!m_zone_id)
{
LogDynamicZones("CreateInstance failed, invalid zone id [{}]", m_zone_id);
return 0;
}
uint16_t unused_instance_id = 0;
if (!GetDatabase().GetUnusedInstanceID(unused_instance_id)) // todo: doesn't this race with insert?
{
LogDynamicZones("Failed to find unused instance id");
return 0;
}
m_start_time = std::chrono::system_clock::now();
m_expire_time = m_start_time + m_duration;
auto insert_instance = InstanceListRepository::NewEntity();
insert_instance.id = unused_instance_id;
insert_instance.zone = m_zone_id;
insert_instance.version = m_zone_version;
insert_instance.start_time = static_cast<int>(std::chrono::system_clock::to_time_t(m_start_time));
insert_instance.duration = static_cast<int>(m_duration.count());
insert_instance.never_expires = m_never_expires;
auto instance = InstanceListRepository::InsertOne(GetDatabase(), insert_instance);
if (instance.id == 0)
{
LogDynamicZones("Failed to create instance [{}] for zone [{}]", unused_instance_id, m_zone_id);
return 0;
}
m_instance_id = instance.id;
return m_instance_id;
}
void DynamicZoneBase::LoadRepositoryResult(DynamicZonesRepository::DynamicZoneInstance&& dz_entry)
{
m_id = dz_entry.id;
m_instance_id = dz_entry.instance_id;
m_type = static_cast<DynamicZoneType>(dz_entry.type);
m_compass.zone_id = dz_entry.compass_zone_id;
m_compass.x = dz_entry.compass_x;
m_compass.y = dz_entry.compass_y;
m_compass.z = dz_entry.compass_z;
m_safereturn.zone_id = dz_entry.safe_return_zone_id;
m_safereturn.x = dz_entry.safe_return_x;
m_safereturn.y = dz_entry.safe_return_y;
m_safereturn.z = dz_entry.safe_return_z;
m_safereturn.heading = dz_entry.safe_return_heading;
m_zonein.x = dz_entry.zone_in_x;
m_zonein.y = dz_entry.zone_in_y;
m_zonein.z = dz_entry.zone_in_z;
m_zonein.heading = dz_entry.zone_in_heading;
m_has_zonein = (dz_entry.has_zone_in != 0);
// instance_list portion
m_zone_id = dz_entry.zone;
m_zone_version = dz_entry.version;
m_start_time = std::chrono::system_clock::from_time_t(dz_entry.start_time);
m_duration = std::chrono::seconds(dz_entry.duration);
m_never_expires = (dz_entry.never_expires != 0);
m_expire_time = m_start_time + m_duration;
}
void DynamicZoneBase::AddMemberFromRepositoryResult(
DynamicZoneMembersRepository::MemberWithName&& entry)
{
auto status = DynamicZoneMemberStatus::Unknown;
AddInternalMember({ entry.character_id, std::move(entry.character_name), status });
}
uint32_t DynamicZoneBase::SaveToDatabase()
{
LogDynamicZonesDetail("Saving dz instance [{}] to database", m_instance_id);
if (m_instance_id != 0)
{
auto insert_dz = DynamicZonesRepository::NewEntity();
insert_dz.instance_id = m_instance_id,
insert_dz.type = static_cast<int>(m_type);
insert_dz.compass_zone_id = m_compass.zone_id;
insert_dz.compass_x = m_compass.x;
insert_dz.compass_y = m_compass.y;
insert_dz.compass_z = m_compass.z;
insert_dz.safe_return_zone_id = m_safereturn.zone_id;
insert_dz.safe_return_x = m_safereturn.x;
insert_dz.safe_return_y = m_safereturn.y;
insert_dz.safe_return_z = m_safereturn.z;
insert_dz.safe_return_heading = m_safereturn.heading;
insert_dz.zone_in_x = m_zonein.x;
insert_dz.zone_in_y = m_zonein.y;
insert_dz.zone_in_z = m_zonein.z;
insert_dz.zone_in_heading = m_zonein.heading;
insert_dz.has_zone_in = m_has_zonein;
auto inserted_dz = DynamicZonesRepository::InsertOne(GetDatabase(), insert_dz);
return inserted_dz.id;
}
return 0;
}
void DynamicZoneBase::AddCharacter(uint32_t character_id)
{
DynamicZoneMembersRepository::AddMember(GetDatabase(), m_id, character_id);
GetDatabase().AddClientToInstance(m_instance_id, character_id);
SendInstanceAddRemoveCharacter(character_id, false); // stops client kick timer
}
void DynamicZoneBase::RemoveCharacter(uint32_t character_id)
{
DynamicZoneMembersRepository::RemoveMember(GetDatabase(), m_id, character_id);
GetDatabase().RemoveClientFromInstance(m_instance_id, character_id);
SendInstanceAddRemoveCharacter(character_id, true); // start client kick timer
}
void DynamicZoneBase::RemoveAllCharacters(bool enable_removal_timers)
{
if (GetInstanceID() == 0)
{
return;
}
if (enable_removal_timers)
{
SendInstanceRemoveAllCharacters();
}
DynamicZoneMembersRepository::RemoveAllMembers(GetDatabase(), m_id);
GetDatabase().RemoveClientsFromInstance(GetInstanceID());
}
void DynamicZoneBase::SaveMembers(const std::vector<DynamicZoneMember>& members)
{
LogDynamicZonesDetail("Saving [{}] member(s) for dz [{}]", members.size(), m_id);
m_members = members;
// the lower level instance_list_players needs to be kept updated as well
std::vector<DynamicZoneMembersRepository::DynamicZoneMembers> insert_members;
std::vector<InstanceListPlayerRepository::InstanceListPlayer> insert_players;
for (const auto& member : m_members)
{
DynamicZoneMembersRepository::DynamicZoneMembers member_entry{};
member_entry.dynamic_zone_id = m_id;
member_entry.character_id = member.id;
member_entry.is_current_member = true;
insert_members.emplace_back(member_entry);
InstanceListPlayerRepository::InstanceListPlayer player_entry;
player_entry.id = static_cast<int>(m_instance_id);
player_entry.charid = static_cast<int>(member.id);
insert_players.emplace_back(player_entry);
}
DynamicZoneMembersRepository::InsertOrUpdateMany(GetDatabase(), insert_members);
InstanceListPlayerRepository::InsertOrUpdateMany(GetDatabase(), insert_players);
}
void DynamicZoneBase::SetCompass(const DynamicZoneLocation& location, bool update_db)
{
ProcessCompassChange(location);
if (update_db)
{
LogDynamicZonesDetail("Saving [{}] compass zone: [{}] xyz: ([{}], [{}], [{}])",
m_id, m_compass.zone_id, m_compass.x, m_compass.y, m_compass.z);
DynamicZonesRepository::UpdateCompass(GetDatabase(),
m_id, m_compass.zone_id, m_compass.x, m_compass.y, m_compass.z);
SendGlobalLocationChange(ServerOP_DzSetCompass, location);
}
}
void DynamicZoneBase::SetCompass(uint32_t zone_id, float x, float y, float z, bool update_db)
{
SetCompass({ zone_id, x, y, z, 0.0f }, update_db);
}
void DynamicZoneBase::SetSafeReturn(const DynamicZoneLocation& location, bool update_db)
{
m_safereturn = location;
if (update_db)
{
LogDynamicZonesDetail("Saving [{}] safereturn zone: [{}] xyzh: ([{}], [{}], [{}], [{}])",
m_id, m_safereturn.zone_id, m_safereturn.x, m_safereturn.y, m_safereturn.z, m_safereturn.heading);
DynamicZonesRepository::UpdateSafeReturn(GetDatabase(), m_id, m_safereturn.zone_id,
m_safereturn.x, m_safereturn.y, m_safereturn.z, m_safereturn.heading);
SendGlobalLocationChange(ServerOP_DzSetSafeReturn, location);
}
}
void DynamicZoneBase::SetSafeReturn(uint32_t zone_id, float x, float y, float z, float heading, bool update_db)
{
SetSafeReturn({ zone_id, x, y, z, heading }, update_db);
}
void DynamicZoneBase::SetZoneInLocation(const DynamicZoneLocation& location, bool update_db)
{
m_zonein = location;
m_has_zonein = true;
if (update_db)
{
LogDynamicZonesDetail("Saving [{}] zonein zone: [{}] xyzh: ([{}], [{}], [{}], [{}])",
m_id, m_zone_id, m_zonein.x, m_zonein.y, m_zonein.z, m_zonein.heading);
DynamicZonesRepository::UpdateZoneIn(GetDatabase(), m_id, m_zone_id,
m_zonein.x, m_zonein.y, m_zonein.z, m_zonein.heading, m_has_zonein);
SendGlobalLocationChange(ServerOP_DzSetZoneIn, location);
}
}
void DynamicZoneBase::SetZoneInLocation(float x, float y, float z, float heading, bool update_db)
{
SetZoneInLocation({ 0, x, y, z, heading }, update_db);
}
uint32_t DynamicZoneBase::GetSecondsRemaining() const
{
auto remaining = std::chrono::duration_cast<std::chrono::seconds>(GetDurationRemaining()).count();
return std::max(0, static_cast<int>(remaining));
}
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerAddRemoveCharacterPacket(
uint32_t character_id, bool removed)
{
constexpr uint32_t pack_size = sizeof(ServerDzCharacter_Struct);
auto pack = std::make_unique<ServerPacket>(ServerOP_DzAddRemoveCharacter, pack_size);
auto buf = reinterpret_cast<ServerDzCharacter_Struct*>(pack->pBuffer);
buf->zone_id = GetZoneID();
buf->instance_id = GetInstanceID();
buf->remove = removed;
buf->character_id = character_id;
return pack;
}
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerRemoveAllCharactersPacket()
{
constexpr uint32_t pack_size = sizeof(ServerDzCharacter_Struct);
auto pack = std::make_unique<ServerPacket>(ServerOP_DzRemoveAllCharacters, pack_size);
auto buf = reinterpret_cast<ServerDzCharacter_Struct*>(pack->pBuffer);
buf->zone_id = GetZoneID();
buf->instance_id = GetInstanceID();
buf->remove = true;
buf->character_id = 0;
return pack;
}
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerDzLocationPacket(
uint16_t server_opcode, const DynamicZoneLocation& location)
{
constexpr uint32_t pack_size = sizeof(ServerDzLocation_Struct);
auto pack = std::make_unique<ServerPacket>(server_opcode, pack_size);
auto buf = reinterpret_cast<ServerDzLocation_Struct*>(pack->pBuffer);
buf->dz_id = GetID();
buf->sender_zone_id = GetCurrentZoneID();
buf->sender_instance_id = GetCurrentInstanceID();
buf->zone_id = location.zone_id;
buf->x = location.x;
buf->y = location.y;
buf->z = location.z;
buf->heading = location.heading;
return pack;
}
uint32_t DynamicZoneBase::GetDatabaseMemberCount()
{
return DynamicZoneMembersRepository::GetCountWhere(GetDatabase(),
fmt::format("dynamic_zone_id = {} AND is_current_member = TRUE", m_id));
}
bool DynamicZoneBase::HasDatabaseMember(uint32_t character_id)
{
if (character_id == 0)
{
return false;
}
auto entries = DynamicZoneMembersRepository::GetWhere(GetDatabase(), fmt::format(
"dynamic_zone_id = {} AND character_id = {} AND is_current_member = TRUE",
m_id, character_id
));
return entries.size() != 0;
}
void DynamicZoneBase::AddInternalMember(const DynamicZoneMember& member)
{
if (!HasMember(member.id))
{
m_members.emplace_back(member);
}
}
void DynamicZoneBase::RemoveInternalMember(uint32_t character_id)
{
m_members.erase(std::remove_if(m_members.begin(), m_members.end(),
[&](const DynamicZoneMember& member) { return member.id == character_id; }
), m_members.end());
}
bool DynamicZoneBase::HasMember(uint32_t character_id)
{
return std::any_of(m_members.begin(), m_members.end(),
[&](const DynamicZoneMember& member) { return member.id == character_id; });
}
bool DynamicZoneBase::HasMember(const std::string& character_name)
{
return std::any_of(m_members.begin(), m_members.end(),
[&](const DynamicZoneMember& member) {
return strcasecmp(member.name.c_str(), character_name.c_str()) == 0;
});
}
DynamicZoneMember DynamicZoneBase::GetMemberData(uint32_t character_id)
{
auto it = std::find_if(m_members.begin(), m_members.end(),
[&](const DynamicZoneMember& member) { return member.id == character_id; });
DynamicZoneMember member_data;
if (it != m_members.end())
{
member_data = *it;
}
return member_data;
}
DynamicZoneMember DynamicZoneBase::GetMemberData(const std::string& character_name)
{
auto it = std::find_if(m_members.begin(), m_members.end(),
[&](const DynamicZoneMember& member) {
return strcasecmp(member.name.c_str(), character_name.c_str()) == 0;
});
DynamicZoneMember member_data;
if (it != m_members.end())
{
member_data = *it;
}
return member_data;
}
bool DynamicZoneBase::SetInternalMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status)
{
if (status == DynamicZoneMemberStatus::InDynamicZone && !RuleB(DynamicZone, EnableInDynamicZoneStatus))
{
status = DynamicZoneMemberStatus::Online;
}
if (character_id == m_leader.id)
{
m_leader.status = status;
}
auto it = std::find_if(m_members.begin(), m_members.end(),
[&](const DynamicZoneMember& member) { return member.id == character_id; });
if (it != m_members.end() && it->status != status)
{
it->status = status;
return true;
}
return false;
}
std::string DynamicZoneBase::GetDynamicZoneTypeName(DynamicZoneType dz_type)
{
switch (dz_type)
{
case DynamicZoneType::Expedition:
return "Expedition";
case DynamicZoneType::Tutorial:
return "Tutorial";
case DynamicZoneType::Task:
return "Task";
case DynamicZoneType::Mission:
return "Mission";
case DynamicZoneType::Quest:
return "Quest";
}
return "Unknown";
}
+154
View File
@@ -0,0 +1,154 @@
#ifndef COMMON_DYNAMIC_ZONE_BASE_H
#define COMMON_DYNAMIC_ZONE_BASE_H
#include "eq_constants.h"
#include "repositories/dynamic_zones_repository.h"
#include "repositories/dynamic_zone_members_repository.h"
#include <algorithm>
#include <chrono>
#include <cstdint>
#include <memory>
#include <string>
#include <vector>
class Database;
class ServerPacket;
struct DynamicZoneMember
{
uint32_t id = 0;
std::string name;
DynamicZoneMemberStatus status = DynamicZoneMemberStatus::Online;
DynamicZoneMember() = default;
DynamicZoneMember(uint32_t id, std::string name_)
: id(id), name{std::move(name_)} {}
DynamicZoneMember(uint32_t id, std::string name_, DynamicZoneMemberStatus status_)
: id(id), name{std::move(name_)}, status(status_) {}
bool IsOnline() const { return status == DynamicZoneMemberStatus::Online ||
status == DynamicZoneMemberStatus::InDynamicZone; }
bool IsValid() const { return id != 0 && !name.empty(); }
};
struct DynamicZoneLocation
{
uint32_t zone_id = 0;
float x = 0.0f;
float y = 0.0f;
float z = 0.0f;
float heading = 0.0f;
DynamicZoneLocation() = default;
DynamicZoneLocation(uint32_t zone_id_, float x_, float y_, float z_, float heading_)
: zone_id(zone_id_), x(x_), y(y_), z(z_), heading(heading_) {}
};
class DynamicZoneBase
{
public:
virtual ~DynamicZoneBase() = default;
DynamicZoneBase(const DynamicZoneBase&) = default;
DynamicZoneBase(DynamicZoneBase&&) = default;
DynamicZoneBase& operator=(const DynamicZoneBase&) = default;
DynamicZoneBase& operator=(DynamicZoneBase&&) = default;
DynamicZoneBase() = default;
DynamicZoneBase(uint32_t dz_id) : m_id(dz_id) {}
DynamicZoneBase(DynamicZoneType type) : m_type(type) {}
DynamicZoneBase(DynamicZonesRepository::DynamicZoneInstance&& entry);
static std::string GetDynamicZoneTypeName(DynamicZoneType dz_type);
virtual void SetSecondsRemaining(uint32_t seconds_remaining) = 0;
uint64_t GetExpireTime() const { return std::chrono::system_clock::to_time_t(m_expire_time); }
uint32_t GetID() const { return m_id; }
uint16_t GetInstanceID() const { return static_cast<uint16_t>(m_instance_id); }
uint32_t GetMaxPlayers() const { return m_max_players; }
uint32_t GetMemberCount() const { return static_cast<uint32_t>(m_members.size()); }
uint32_t GetMinPlayers() const { return m_min_players; }
uint32_t GetSecondsRemaining() const;
uint16_t GetZoneID() const { return static_cast<uint16_t>(m_zone_id); }
uint32_t GetZoneIndex() const { return (m_instance_id << 16) | (m_zone_id & 0xffff); }
uint32_t GetZoneVersion() const { return m_zone_version; }
DynamicZoneType GetType() const { return m_type; }
const std::string& GetLeaderName() const { return m_leader.name; }
const std::string& GetName() const { return m_name; }
const DynamicZoneMember& GetLeader() const { return m_leader; }
const std::vector<DynamicZoneMember>& GetMembers() const { return m_members; }
const DynamicZoneLocation& GetCompassLocation() const { return m_compass; }
const DynamicZoneLocation& GetSafeReturnLocation() const { return m_safereturn; }
const DynamicZoneLocation& GetZoneInLocation() const { return m_zonein; }
std::chrono::system_clock::duration GetDurationRemaining() const { return m_expire_time - std::chrono::system_clock::now(); }
void AddCharacter(uint32_t character_id);
void AddInternalMember(const DynamicZoneMember& member);
void AddMemberFromRepositoryResult(DynamicZoneMembersRepository::MemberWithName&& entry);
void ClearInternalMembers() { m_members.clear(); }
uint32_t Create();
uint32_t GetDatabaseMemberCount();
DynamicZoneMember GetMemberData(uint32_t character_id);
DynamicZoneMember GetMemberData(const std::string& character_name);
bool HasDatabaseMember(uint32_t character_id);
bool HasMember(uint32_t character_id);
bool HasMember(const std::string& character_name);
bool HasMembers() const { return !m_members.empty(); }
bool HasZoneInLocation() const { return m_has_zonein; }
bool IsExpired() const { return m_expire_time < std::chrono::system_clock::now(); }
bool IsInstanceID(uint32_t instance_id) const { return (m_instance_id != 0 && m_instance_id == instance_id); }
bool IsValid() const { return m_instance_id != 0; }
bool IsSameDz(uint32_t zone_id, uint32_t instance_id) const { return zone_id == m_zone_id && instance_id == m_instance_id; }
void RemoveAllCharacters(bool enable_removal_timers = true);
void RemoveCharacter(uint32_t character_id);
void RemoveInternalMember(uint32_t character_id);
void SaveMembers(const std::vector<DynamicZoneMember>& members);
void SetCompass(const DynamicZoneLocation& location, bool update_db = false);
void SetCompass(uint32_t zone_id, float x, float y, float z, bool update_db = false);
bool SetInternalMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
void SetLeader(const DynamicZoneMember& leader) { m_leader = leader; }
void SetMaxPlayers(uint32_t max_players) { m_max_players = max_players; }
void SetMinPlayers(uint32_t min_players) { m_min_players = min_players; }
void SetName(const std::string& name) { m_name = name; }
void SetSafeReturn(const DynamicZoneLocation& location, bool update_db = false);
void SetSafeReturn(uint32_t zone_id, float x, float y, float z, float heading, bool update_db = false);
void SetZoneInLocation(const DynamicZoneLocation& location, bool update_db = false);
void SetZoneInLocation(float x, float y, float z, float heading, bool update_db = false);
protected:
virtual uint16_t GetCurrentInstanceID() { return 0; }
virtual uint16_t GetCurrentZoneID() { return 0; }
virtual Database& GetDatabase() = 0;
virtual void ProcessCompassChange(const DynamicZoneLocation& location) { m_compass = location; }
virtual void SendInstanceAddRemoveCharacter(uint32_t character_id, bool remove) = 0;
virtual void SendInstanceRemoveAllCharacters() = 0;
virtual void SendGlobalLocationChange(uint16_t server_opcode, const DynamicZoneLocation& location) = 0;
uint32_t CreateInstance();
void LoadRepositoryResult(DynamicZonesRepository::DynamicZoneInstance&& dz_entry);
uint32_t SaveToDatabase();
std::unique_ptr<ServerPacket> CreateServerAddRemoveCharacterPacket(uint32_t character_id, bool removed);
std::unique_ptr<ServerPacket> CreateServerRemoveAllCharactersPacket();
std::unique_ptr<ServerPacket> CreateServerDzLocationPacket(uint16_t server_opcode, const DynamicZoneLocation& location);
uint32_t m_id = 0;
uint32_t m_zone_id = 0;
uint32_t m_instance_id = 0;
uint32_t m_zone_version = 0;
uint32_t m_min_players = 0;
uint32_t m_max_players = 0;
bool m_never_expires = false;
bool m_has_zonein = false;
std::string m_name;
DynamicZoneMember m_leader;
DynamicZoneType m_type{ DynamicZoneType::None };
DynamicZoneLocation m_compass;
DynamicZoneLocation m_safereturn;
DynamicZoneLocation m_zonein;
std::chrono::seconds m_duration;
std::chrono::time_point<std::chrono::system_clock> m_start_time;
std::chrono::time_point<std::chrono::system_clock> m_expire_time;
std::vector<DynamicZoneMember> m_members;
};
#endif
+26
View File
@@ -438,6 +438,13 @@ static const uint8 SkillDamageTypes[EQ::skills::HIGHEST_SKILL + 1] = // change t
static const uint32 MAX_SPELL_DB_ID_VAL = 65535;
static const uint32 DB_SPELL_CAZIC_TOUCH = 982;
static const uint32 DB_SPELL_TOUCH_OF_VINITRAS = 2859;
static const uint32 DB_FACTION_GEM_CHOPPERS = 255;
static const uint32 DB_FACTION_HERETICS = 265;
static const uint32 DB_FACTION_KING_AKANON = 333;
enum ChatChannelNames : uint16
{
ChatChannel_Guild = 0,
@@ -464,4 +471,23 @@ namespace ZoneBlockedSpellTypes {
const uint8 Region = 2;
};
enum class DynamicZoneType
{
None = 0,
Expedition,
Tutorial,
Task,
Mission, // Shared Task
Quest
};
enum class DynamicZoneMemberStatus : uint8_t
{
Unknown = 0,
Online,
Offline,
InDynamicZone,
LinkDead
};
#endif /*COMMON_EQ_CONSTANTS_H*/
+2 -2
View File
@@ -794,7 +794,7 @@ void EQ::inventory::InitializeDynamicLookups() {
continue;
// direct manipulation of lookup indices is safe so long as (int)ClientVersion::<mob> == (int)MobVersion::<mob>
inventory_dynamic_nongm_lookup_entries[iter] = std::unique_ptr<LookupEntry>(new LookupEntry(inventory_static_lookup_entries[iter]));
inventory_dynamic_nongm_lookup_entries[iter] = std::make_unique<LookupEntry>(inventory_static_lookup_entries[iter]);
// clamp affected fields to the lowest standard
inventory_dynamic_nongm_lookup_entries[iter]->InventoryTypeSize.Bank = Titanium::invtype::BANK_SIZE; // bank size
@@ -864,7 +864,7 @@ void EQ::inventory::InitializeDynamicLookups() {
}
// direct manipulation of lookup indices is safe so long as (int)ClientVersion::<client> == (int)MobVersion::<client>
inventory_dynamic_gm_lookup_entries[iter] = std::unique_ptr<LookupEntry>(new LookupEntry(inventory_static_lookup_entries[iter]));
inventory_dynamic_gm_lookup_entries[iter] = std::make_unique<LookupEntry>(inventory_static_lookup_entries[iter]);
inventory_dynamic_gm_lookup_entries[iter]->PossessionsBitmask = 0; // we'll fix later
inventory_dynamic_gm_lookup_entries[iter]->CorpseBitmask = 0; // we'll fix later
+15 -14
View File
@@ -829,7 +829,7 @@ struct LeadershipAA_Struct {
* Size: 20 Octets
*/
struct BindStruct {
/*000*/ uint32 zoneId;
/*000*/ uint32 zone_id;
/*004*/ float x;
/*008*/ float y;
/*012*/ float z;
@@ -1772,7 +1772,7 @@ struct GMZoneRequest_Struct {
/*0068*/ float x;
/*0072*/ float y;
/*0076*/ float z;
/*0080*/ char unknown0080[4];
/*0080*/ float heading;
/*0084*/ uint32 success; // 0 if command failed, 1 if succeeded?
/*0088*/
// /*072*/ int8 success; // =0 client->server, =1 server->client, -X=specific error
@@ -3247,7 +3247,7 @@ struct TraderClick_Struct{
};
struct FormattedMessage_Struct{
uint32 unknown0;
uint32 unknown0; // 1 means from world server
uint32 string_id;
uint32 type;
char message[0];
@@ -3255,7 +3255,7 @@ struct FormattedMessage_Struct{
struct SimpleMessage_Struct{
uint32 string_id;
uint32 color;
uint32 unknown8;
uint32 unknown8; // 1 means from world server
};
struct GuildMemberUpdate_Struct {
@@ -4861,30 +4861,31 @@ struct ExpeditionInviteResponse_Struct
/*079*/ uint8 unknown079; // padding garbage?
};
struct ExpeditionInfo_Struct
struct DynamicZoneInfo_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004; // added after titanium
/*008*/ uint32 assigned; // padded bool, 0: not in expedition (clear data), 1: in expedition
/*008*/ uint32 assigned; // padded bool, 0: clear info, 1: fill window info
/*012*/ uint32 max_players;
/*016*/ char expedition_name[128];
/*016*/ char dz_name[128];
/*144*/ char leader_name[64];
//*208*/ uint32 dz_type; // only in newer clients, if not 1 (expedition type) window does not auto show when dz info assigned
};
struct ExpeditionMemberEntry_Struct
struct DynamicZoneMemberEntry_Struct
{
/*000*/ char name[64]; // variable length, null terminated, max 0x40 (64)
/*064*/ uint8 expedition_status; // 0: unknown, 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
/*000*/ char name[64]; // variable length, null terminated, max 0x40 (64)
/*064*/ uint8 online_status; // 0: unknown, 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
};
struct ExpeditionMemberList_Struct
struct DynamicZoneMemberList_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 member_count;
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
/*008*/ DynamicZoneMemberEntry_Struct members[0]; // variable length
};
struct ExpeditionMemberListName_Struct
struct DynamicZoneMemberListName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
@@ -4907,7 +4908,7 @@ struct ExpeditionLockoutTimers_Struct
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
};
struct ExpeditionSetLeaderName_Struct
struct DynamicZoneLeaderName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
+2 -5
View File
@@ -127,6 +127,7 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
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);
/**
* RFC 5424
@@ -206,11 +207,7 @@ std::string EQEmuLogSys::FormatOutMessageString(
const std::string &in_message
)
{
std::string return_string;
if (IsRfc5424LogCategory(log_category)) {
return_string = "[" + GetPlatformName() + "] ";
}
std::string return_string = "[" + GetPlatformName() + "] ";
return return_string + "[" + Logs::LogCategoryName[log_category] + "] " + in_message;
}
+2 -2
View File
@@ -120,7 +120,7 @@ namespace Logs {
Loot,
Expeditions,
DynamicZones,
Group,
Scheduler,
MaxCategoryID /* Don't Remove this */
};
@@ -200,7 +200,7 @@ namespace Logs {
"Loot",
"Expeditions",
"DynamicZones",
"Group",
"Scheduler",
};
}
+10
View File
@@ -636,6 +636,16 @@
OutF(LogSys, Logs::Detail, Logs::DynamicZones, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogScheduler(message, ...) do {\
if (LogSys.log_settings[Logs::Scheduler].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::Scheduler, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogSchedulerDetail(message, ...) do {\
if (LogSys.log_settings[Logs::Scheduler].is_category_enabled == 1)\
OutF(LogSys, Logs::Detail, Logs::Scheduler, __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__);\
+1 -1
View File
@@ -51,7 +51,7 @@ namespace EQ {
void Stop() {
if (m_timer) {
uv_close((uv_handle_t*)m_timer, [](uv_handle_t* handle) {
delete handle;
delete (uv_timer_t *)handle;
});
m_timer = nullptr;
}
+23
View File
@@ -0,0 +1,23 @@
#include "expedition_base.h"
#include "repositories/expeditions_repository.h"
ExpeditionBase::ExpeditionBase(uint32_t id, const std::string& uuid,
const std::string& expedition_name, const DynamicZoneMember& leader
) :
m_id(id),
m_uuid(uuid),
m_expedition_name(expedition_name),
m_leader(leader)
{
}
void ExpeditionBase::LoadRepositoryResult(ExpeditionsRepository::ExpeditionWithLeader&& entry)
{
m_id = entry.id;
m_uuid = std::move(entry.uuid);
m_expedition_name = std::move(entry.expedition_name);
m_add_replay_on_join = entry.add_replay_on_join;
m_is_locked = entry.is_locked;
m_leader.id = entry.leader_id;
m_leader.name = std::move(entry.leader_name);
}
+40
View File
@@ -0,0 +1,40 @@
#ifndef COMMON_EXPEDITION_BASE_H
#define COMMON_EXPEDITION_BASE_H
#include "dynamic_zone_base.h"
#include "repositories/expeditions_repository.h"
#include <cstdint>
#include <string>
class ExpeditionBase
{
public:
virtual ~ExpeditionBase() = default;
ExpeditionBase(const ExpeditionBase&) = default;
ExpeditionBase(ExpeditionBase&&) = default;
ExpeditionBase& operator=(const ExpeditionBase&) = default;
ExpeditionBase& operator=(ExpeditionBase&&) = default;
uint32_t GetID() const { return m_id; }
uint32_t GetLeaderID() const { return m_leader.id; }
const std::string& GetName() const { return m_expedition_name; }
const std::string& GetLeaderName() const { return m_leader.name; }
const std::string& GetUUID() const { return m_uuid; }
const DynamicZoneMember& GetLeader() const { return m_leader; }
void LoadRepositoryResult(ExpeditionsRepository::ExpeditionWithLeader&& entry);
protected:
ExpeditionBase() = default;
ExpeditionBase(uint32_t id, const std::string& uuid, const std::string& expedition_name,
const DynamicZoneMember& leader);
uint32_t m_id = 0;
bool m_is_locked = false;
bool m_add_replay_on_join = true;
std::string m_uuid;
std::string m_expedition_name;
DynamicZoneMember m_leader;
};
#endif
@@ -27,16 +27,16 @@
const char* const DZ_REPLAY_TIMER_NAME = "Replay Timer"; // see December 14, 2016 patch notes
ExpeditionLockoutTimer::ExpeditionLockoutTimer(
const std::string& expedition_uuid, const std::string& expedition_name,
const std::string& event_name, uint64_t expire_time, uint32_t duration
std::string expedition_uuid, std::string expedition_name,
std::string event_name, uint64_t expire_time, uint32_t duration
) :
m_expedition_uuid(expedition_uuid),
m_expedition_name(expedition_name),
m_event_name(event_name),
m_expedition_uuid{std::move(expedition_uuid)},
m_expedition_name{std::move(expedition_name)},
m_event_name{std::move(event_name)},
m_expire_time(std::chrono::system_clock::from_time_t(expire_time)),
m_duration(duration)
{
if (event_name == DZ_REPLAY_TIMER_NAME)
if (m_event_name == DZ_REPLAY_TIMER_NAME)
{
m_is_replay_timer = true;
}
@@ -31,8 +31,8 @@ class ExpeditionLockoutTimer
public:
ExpeditionLockoutTimer() = default;
ExpeditionLockoutTimer(
const std::string& expedition_uuid, const std::string& expedition_name,
const std::string& event_name, uint64_t expire_time, uint32_t duration);
std::string expedition_uuid, std::string expedition_name,
std::string event_name, uint64_t expire_time, uint32_t duration);
static ExpeditionLockoutTimer CreateLockout(
const std::string& expedition_name, const std::string& event_name,
+1 -1
View File
@@ -4,7 +4,7 @@
EQ::Net::ConsoleServer::ConsoleServer(const std::string &addr, int port)
{
m_server.reset(new EQ::Net::TCPServer());
m_server = std::make_unique<EQ::Net::TCPServer>();
m_server->Listen(addr, port, false, [this](std::shared_ptr<EQ::Net::TCPConnection> connection) {
ConsoleServerConnection *c = new ConsoleServerConnection(this, connection);
m_connections.insert(std::make_pair(c->GetUUID(), std::unique_ptr<ConsoleServerConnection>(c)));
+1 -1
View File
@@ -3,7 +3,7 @@
#include "../eqemu_logsys.h"
EQ::Net::ServertalkClient::ServertalkClient(const std::string &addr, int port, bool ipv6, const std::string &identifier, const std::string &credentials)
: m_timer(std::unique_ptr<EQ::Timer>(new EQ::Timer(100, true, std::bind(&EQ::Net::ServertalkClient::Connect, this))))
: m_timer(std::make_unique<EQ::Timer>(100, true, std::bind(&EQ::Net::ServertalkClient::Connect, this)))
{
m_port = port;
m_ipv6 = ipv6;
@@ -3,7 +3,7 @@
#include "../eqemu_logsys.h"
EQ::Net::ServertalkLegacyClient::ServertalkLegacyClient(const std::string &addr, int port, bool ipv6)
: m_timer(std::unique_ptr<EQ::Timer>(new EQ::Timer(100, true, std::bind(&EQ::Net::ServertalkLegacyClient::Connect, this))))
: m_timer(std::make_unique<EQ::Timer>(100, true, std::bind(&EQ::Net::ServertalkLegacyClient::Connect, this)))
{
m_port = port;
m_ipv6 = ipv6;
+1 -1
View File
@@ -13,7 +13,7 @@ void EQ::Net::ServertalkServer::Listen(const ServertalkServerOptions& opts)
m_encrypted = opts.encrypted;
m_credentials = opts.credentials;
m_allow_downgrade = opts.allow_downgrade;
m_server.reset(new EQ::Net::TCPServer());
m_server = std::make_unique<EQ::Net::TCPServer>();
m_server->Listen(opts.port, opts.ipv6, [this](std::shared_ptr<EQ::Net::TCPConnection> connection) {
m_unident_connections.push_back(std::make_shared<ServertalkServerConnection>(connection, this, m_encrypted, m_allow_downgrade));
});
+2 -2
View File
@@ -2,7 +2,7 @@
#include "../event/event_loop.h"
void on_close_handle(uv_handle_t* handle) {
delete handle;
delete (uv_tcp_t *)handle;
}
EQ::Net::TCPConnection::TCPConnection(uv_tcp_t *socket)
@@ -115,7 +115,7 @@ void EQ::Net::TCPConnection::Disconnect()
connection->m_on_disconnect_cb(connection);
}
delete handle;
delete (uv_tcp_t *)handle;
});
m_socket = nullptr;
}
+1 -1
View File
@@ -2,7 +2,7 @@
#include "../event/event_loop.h"
void on_close_tcp_server_handle(uv_handle_t* handle) {
delete handle;
delete (uv_tcp_t *)handle;
}
EQ::Net::TCPServer::TCPServer()
+4 -4
View File
@@ -34,8 +34,8 @@ struct EQ::Net::WebsocketServer::Impl
EQ::Net::WebsocketServer::WebsocketServer(const std::string &addr, int port)
{
_impl.reset(new Impl());
_impl->server.reset(new EQ::Net::TCPServer());
_impl = std::make_unique<Impl>();
_impl->server = std::make_unique<EQ::Net::TCPServer>();
_impl->server->Listen(addr, port, false, [this](std::shared_ptr<EQ::Net::TCPConnection> connection) {
auto wsc = _impl->ws_server.get_connection();
WebsocketServerConnection *c = new WebsocketServerConnection(this, connection, wsc);
@@ -53,7 +53,7 @@ EQ::Net::WebsocketServer::WebsocketServer(const std::string &addr, int port)
return websocketpp::lib::error_code();
});
_impl->ping_timer.reset(new EQ::Timer(5000, true, [this](EQ::Timer *t) {
_impl->ping_timer = std::make_unique<EQ::Timer>(5000, true, [this](EQ::Timer *t) {
auto iter = _impl->connections.begin();
while (iter != _impl->connections.end()) {
@@ -67,7 +67,7 @@ EQ::Net::WebsocketServer::WebsocketServer(const std::string &addr, int port)
iter++;
}
}));
});
_impl->methods.insert(std::make_pair("login", MethodHandlerEntry(std::bind(&WebsocketServer::Login, this, std::placeholders::_1, std::placeholders::_2), 0)));
_impl->methods.insert(std::make_pair("subscribe", MethodHandlerEntry(std::bind(&WebsocketServer::Subscribe, this, std::placeholders::_1, std::placeholders::_2), 0)));
+1 -1
View File
@@ -20,7 +20,7 @@ EQ::Net::WebsocketServerConnection::WebsocketServerConnection(WebsocketServer *p
std::shared_ptr<TCPConnection> connection,
std::shared_ptr<websocket_connection> ws_connection)
{
_impl.reset(new Impl());
_impl = std::make_unique<Impl>();
_impl->parent = parent;
_impl->connection = connection;
_impl->id = EQ::Util::UUID::Generate().ToString();
+11 -11
View File
@@ -772,13 +772,13 @@ namespace RoF
ENCODE(OP_DzExpeditionInfo)
{
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
ENCODE_LENGTH_EXACT(DynamicZoneInfo_Struct);
SETUP_DIRECT_ENCODE(DynamicZoneInfo_Struct, structs::DynamicZoneInfo_Struct);
OUT(client_id);
OUT(assigned);
OUT(max_players);
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strn0cpy(eq->dz_name, emu->dz_name, sizeof(eq->dz_name));
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
FINISH_ENCODE();
@@ -824,8 +824,8 @@ namespace RoF
ENCODE(OP_DzSetLeaderName)
{
ENCODE_LENGTH_EXACT(ExpeditionSetLeaderName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionSetLeaderName_Struct, structs::ExpeditionSetLeaderName_Struct);
ENCODE_LENGTH_EXACT(DynamicZoneLeaderName_Struct);
SETUP_DIRECT_ENCODE(DynamicZoneLeaderName_Struct, structs::DynamicZoneLeaderName_Struct);
OUT(client_id);
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
@@ -835,7 +835,7 @@ namespace RoF
ENCODE(OP_DzMemberList)
{
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
SETUP_VAR_ENCODE(DynamicZoneMemberList_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
@@ -843,7 +843,7 @@ namespace RoF
for (uint32 i = 0; i < emu->member_count; ++i)
{
buf.WriteString(emu->members[i].name);
buf.WriteUInt8(emu->members[i].expedition_status);
buf.WriteUInt8(emu->members[i].online_status);
}
__packet->size = buf.size();
@@ -855,8 +855,8 @@ namespace RoF
ENCODE(OP_DzMemberListName)
{
ENCODE_LENGTH_EXACT(ExpeditionMemberListName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionMemberListName_Struct, structs::ExpeditionMemberListName_Struct);
ENCODE_LENGTH_EXACT(DynamicZoneMemberListName_Struct);
SETUP_DIRECT_ENCODE(DynamicZoneMemberListName_Struct, structs::DynamicZoneMemberListName_Struct);
OUT(client_id);
OUT(add_name);
@@ -867,7 +867,7 @@ namespace RoF
ENCODE(OP_DzMemberListStatus)
{
auto emu = reinterpret_cast<ExpeditionMemberList_Struct*>((*p)->pBuffer);
auto emu = reinterpret_cast<DynamicZoneMemberList_Struct*>((*p)->pBuffer);
if (emu->member_count == 1)
{
ENCODE_FORWARD(OP_DzMemberList);
@@ -1968,7 +1968,7 @@ namespace RoF
for (int r = 0; r < 5; r++)
{
outapp->WriteUInt32(emu->binds[r].zoneId);
outapp->WriteUInt32(emu->binds[r].zone_id);
outapp->WriteFloat(emu->binds[r].x);
outapp->WriteFloat(emu->binds[r].y);
outapp->WriteFloat(emu->binds[r].z);
+11 -11
View File
@@ -821,13 +821,13 @@ namespace RoF2
ENCODE(OP_DzExpeditionInfo)
{
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
ENCODE_LENGTH_EXACT(DynamicZoneInfo_Struct);
SETUP_DIRECT_ENCODE(DynamicZoneInfo_Struct, structs::DynamicZoneInfo_Struct);
OUT(client_id);
OUT(assigned);
OUT(max_players);
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strn0cpy(eq->dz_name, emu->dz_name, sizeof(eq->dz_name));
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
FINISH_ENCODE();
@@ -873,8 +873,8 @@ namespace RoF2
ENCODE(OP_DzSetLeaderName)
{
ENCODE_LENGTH_EXACT(ExpeditionSetLeaderName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionSetLeaderName_Struct, structs::ExpeditionSetLeaderName_Struct);
ENCODE_LENGTH_EXACT(DynamicZoneLeaderName_Struct);
SETUP_DIRECT_ENCODE(DynamicZoneLeaderName_Struct, structs::DynamicZoneLeaderName_Struct);
OUT(client_id);
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
@@ -884,7 +884,7 @@ namespace RoF2
ENCODE(OP_DzMemberList)
{
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
SETUP_VAR_ENCODE(DynamicZoneMemberList_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
@@ -892,7 +892,7 @@ namespace RoF2
for (uint32 i = 0; i < emu->member_count; ++i)
{
buf.WriteString(emu->members[i].name);
buf.WriteUInt8(emu->members[i].expedition_status);
buf.WriteUInt8(emu->members[i].online_status);
}
__packet->size = buf.size();
@@ -904,8 +904,8 @@ namespace RoF2
ENCODE(OP_DzMemberListName)
{
ENCODE_LENGTH_EXACT(ExpeditionMemberListName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionMemberListName_Struct, structs::ExpeditionMemberListName_Struct);
ENCODE_LENGTH_EXACT(DynamicZoneMemberListName_Struct);
SETUP_DIRECT_ENCODE(DynamicZoneMemberListName_Struct, structs::DynamicZoneMemberListName_Struct);
OUT(client_id);
OUT(add_name);
@@ -916,7 +916,7 @@ namespace RoF2
ENCODE(OP_DzMemberListStatus)
{
auto emu = reinterpret_cast<ExpeditionMemberList_Struct*>((*p)->pBuffer);
auto emu = reinterpret_cast<DynamicZoneMemberList_Struct*>((*p)->pBuffer);
if (emu->member_count == 1)
{
ENCODE_FORWARD(OP_DzMemberList);
@@ -2025,7 +2025,7 @@ namespace RoF2
for (int r = 0; r < 5; r++)
{
outapp->WriteUInt32(emu->binds[r].zoneId);
outapp->WriteUInt32(emu->binds[r].zone_id);
outapp->WriteFloat(emu->binds[r].x);
outapp->WriteFloat(emu->binds[r].y);
outapp->WriteFloat(emu->binds[r].z);
+13 -13
View File
@@ -1053,7 +1053,7 @@ struct LeadershipAA_Struct {
* Size: 20 Octets
*/
struct BindStruct {
/*000*/ uint32 zoneId;
/*000*/ uint32 zone_id;
/*004*/ float x;
/*008*/ float y;
/*012*/ float z;
@@ -2084,7 +2084,7 @@ struct GMZoneRequest_Struct {
/*0068*/ float x;
/*0072*/ float y;
/*0076*/ float z;
/*0080*/ char unknown0080[4];
/*0080*/ float heading;
/*0084*/ uint32 success; // 0 if command failed, 1 if succeeded?
/*0088*/
// /*072*/ int8 success; // =0 client->server, =1 server->client, -X=specific error
@@ -4908,31 +4908,31 @@ struct ExpeditionInviteResponse_Struct
/*079*/ uint8 unknown079; // padding garbage?
};
struct ExpeditionInfo_Struct
struct DynamicZoneInfo_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 assigned; // padded bool, 0: not in expedition (clear data), 1: in expedition
/*008*/ uint32 assigned; // padded bool, 0: clear info, 1: fill window info
/*012*/ uint32 max_players;
/*016*/ char expedition_name[128];
/*016*/ char dz_name[128];
/*144*/ char leader_name[64];
//*208*/ uint32 unknown208; // live sends 01 00 00 00 here but client doesn't read it
//*208*/ uint32 dz_type; // only in newer clients, if not 1 (expedition type) window does not auto show when dz info assigned
};
struct ExpeditionMemberEntry_Struct
struct DynamicZoneMemberEntry_Struct
{
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
/*000*/ uint8 expedition_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
/*000*/ uint8 online_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
};
struct ExpeditionMemberList_Struct
struct DynamicZoneMemberList_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 member_count; // number of players in window
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
/*008*/ DynamicZoneMemberEntry_Struct members[0]; // variable length
};
struct ExpeditionMemberListName_Struct
struct DynamicZoneMemberListName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
@@ -4955,7 +4955,7 @@ struct ExpeditionLockoutTimers_Struct
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
};
struct ExpeditionSetLeaderName_Struct
struct DynamicZoneLeaderName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
+11 -11
View File
@@ -998,7 +998,7 @@ struct LeadershipAA_Struct {
* Size: 20 Octets
*/
struct BindStruct {
/*000*/ uint32 zoneId;
/*000*/ uint32 zone_id;
/*004*/ float x;
/*008*/ float y;
/*012*/ float z;
@@ -2062,7 +2062,7 @@ struct GMZoneRequest_Struct {
/*0068*/ float x;
/*0072*/ float y;
/*0076*/ float z;
/*0080*/ char unknown0080[4];
/*0080*/ float heading;
/*0084*/ uint32 success; // 0 if command failed, 1 if succeeded?
/*0088*/
// /*072*/ int8 success; // =0 client->server, =1 server->client, -X=specific error
@@ -4841,30 +4841,30 @@ struct ExpeditionInviteResponse_Struct
/*079*/ uint8 unknown079; // padding garbage?
};
struct ExpeditionInfo_Struct
struct DynamicZoneInfo_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 assigned; // padded bool
/*012*/ uint32 max_players;
/*016*/ char expedition_name[128];
/*016*/ char dz_name[128];
/*144*/ char leader_name[64];
};
struct ExpeditionMemberEntry_Struct
struct DynamicZoneMemberEntry_Struct
{
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
/*000*/ uint8 expedition_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
/*000*/ uint8 online_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
};
struct ExpeditionMemberList_Struct
struct DynamicZoneMemberList_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 member_count; // number of players in window
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
/*008*/ DynamicZoneMemberEntry_Struct members[0]; // variable length
};
struct ExpeditionMemberListName_Struct
struct DynamicZoneMemberListName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
@@ -4887,7 +4887,7 @@ struct ExpeditionLockoutTimers_Struct
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
};
struct ExpeditionSetLeaderName_Struct
struct DynamicZoneLeaderName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
+11 -11
View File
@@ -545,13 +545,13 @@ namespace SoD
ENCODE(OP_DzExpeditionInfo)
{
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
ENCODE_LENGTH_EXACT(DynamicZoneInfo_Struct);
SETUP_DIRECT_ENCODE(DynamicZoneInfo_Struct, structs::DynamicZoneInfo_Struct);
OUT(client_id);
OUT(assigned);
OUT(max_players);
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strn0cpy(eq->dz_name, emu->dz_name, sizeof(eq->dz_name));
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
FINISH_ENCODE();
@@ -597,8 +597,8 @@ namespace SoD
ENCODE(OP_DzSetLeaderName)
{
ENCODE_LENGTH_EXACT(ExpeditionSetLeaderName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionSetLeaderName_Struct, structs::ExpeditionSetLeaderName_Struct);
ENCODE_LENGTH_EXACT(DynamicZoneLeaderName_Struct);
SETUP_DIRECT_ENCODE(DynamicZoneLeaderName_Struct, structs::DynamicZoneLeaderName_Struct);
OUT(client_id);
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
@@ -608,7 +608,7 @@ namespace SoD
ENCODE(OP_DzMemberList)
{
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
SETUP_VAR_ENCODE(DynamicZoneMemberList_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
@@ -616,7 +616,7 @@ namespace SoD
for (uint32 i = 0; i < emu->member_count; ++i)
{
buf.WriteString(emu->members[i].name);
buf.WriteUInt8(emu->members[i].expedition_status);
buf.WriteUInt8(emu->members[i].online_status);
}
__packet->size = buf.size();
@@ -628,8 +628,8 @@ namespace SoD
ENCODE(OP_DzMemberListName)
{
ENCODE_LENGTH_EXACT(ExpeditionMemberListName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionMemberListName_Struct, structs::ExpeditionMemberListName_Struct);
ENCODE_LENGTH_EXACT(DynamicZoneMemberListName_Struct);
SETUP_DIRECT_ENCODE(DynamicZoneMemberListName_Struct, structs::DynamicZoneMemberListName_Struct);
OUT(client_id);
OUT(add_name);
@@ -640,7 +640,7 @@ namespace SoD
ENCODE(OP_DzMemberListStatus)
{
auto emu = reinterpret_cast<ExpeditionMemberList_Struct*>((*p)->pBuffer);
auto emu = reinterpret_cast<DynamicZoneMemberList_Struct*>((*p)->pBuffer);
if (emu->member_count == 1)
{
ENCODE_FORWARD(OP_DzMemberList);
@@ -1475,7 +1475,7 @@ namespace SoD
eq->level1 = emu->level;
// OUT(unknown00022[2]);
for (r = 0; r < 5; r++) {
OUT(binds[r].zoneId);
OUT(binds[r].zone_id);
OUT(binds[r].x);
OUT(binds[r].y);
OUT(binds[r].z);
+11 -11
View File
@@ -803,7 +803,7 @@ struct LeadershipAA_Struct {
* Size: 20 Octets
*/
struct BindStruct {
/*000*/ uint32 zoneId;
/*000*/ uint32 zone_id;
/*004*/ float x;
/*008*/ float y;
/*012*/ float z;
@@ -1714,7 +1714,7 @@ struct GMZoneRequest_Struct {
/*0068*/ float x;
/*0072*/ float y;
/*0076*/ float z;
/*0080*/ char unknown0080[4];
/*0080*/ float heading;
/*0084*/ uint32 success; // 0 if command failed, 1 if succeeded?
/*0088*/
// /*072*/ int8 success; // =0 client->server, =1 server->client, -X=specific error
@@ -4196,30 +4196,30 @@ struct ExpeditionInviteResponse_Struct
/*079*/ uint8 unknown079; // padding garbage?
};
struct ExpeditionInfo_Struct
struct DynamicZoneInfo_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 assigned; // padded bool
/*012*/ uint32 max_players;
/*016*/ char expedition_name[128];
/*016*/ char dz_name[128];
/*144*/ char leader_name[64];
};
struct ExpeditionMemberEntry_Struct
struct DynamicZoneMemberEntry_Struct
{
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
/*000*/ uint8 expedition_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
/*000*/ uint8 online_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
};
struct ExpeditionMemberList_Struct
struct DynamicZoneMemberList_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 member_count; // number of players in window
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
/*008*/ DynamicZoneMemberEntry_Struct members[0]; // variable length
};
struct ExpeditionMemberListName_Struct
struct DynamicZoneMemberListName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
@@ -4242,7 +4242,7 @@ struct ExpeditionLockoutTimers_Struct
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
};
struct ExpeditionSetLeaderName_Struct
struct DynamicZoneLeaderName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
+11 -11
View File
@@ -533,13 +533,13 @@ namespace SoF
ENCODE(OP_DzExpeditionInfo)
{
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
ENCODE_LENGTH_EXACT(DynamicZoneInfo_Struct);
SETUP_DIRECT_ENCODE(DynamicZoneInfo_Struct, structs::DynamicZoneInfo_Struct);
OUT(client_id);
OUT(assigned);
OUT(max_players);
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strn0cpy(eq->dz_name, emu->dz_name, sizeof(eq->dz_name));
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
FINISH_ENCODE();
@@ -585,8 +585,8 @@ namespace SoF
ENCODE(OP_DzSetLeaderName)
{
ENCODE_LENGTH_EXACT(ExpeditionSetLeaderName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionSetLeaderName_Struct, structs::ExpeditionSetLeaderName_Struct);
ENCODE_LENGTH_EXACT(DynamicZoneLeaderName_Struct);
SETUP_DIRECT_ENCODE(DynamicZoneLeaderName_Struct, structs::DynamicZoneLeaderName_Struct);
OUT(client_id);
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
@@ -596,7 +596,7 @@ namespace SoF
ENCODE(OP_DzMemberList)
{
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
SETUP_VAR_ENCODE(DynamicZoneMemberList_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
@@ -604,7 +604,7 @@ namespace SoF
for (uint32 i = 0; i < emu->member_count; ++i)
{
buf.WriteString(emu->members[i].name);
buf.WriteUInt8(emu->members[i].expedition_status);
buf.WriteUInt8(emu->members[i].online_status);
}
__packet->size = buf.size();
@@ -616,8 +616,8 @@ namespace SoF
ENCODE(OP_DzMemberListName)
{
ENCODE_LENGTH_EXACT(ExpeditionMemberListName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionMemberListName_Struct, structs::ExpeditionMemberListName_Struct);
ENCODE_LENGTH_EXACT(DynamicZoneMemberListName_Struct);
SETUP_DIRECT_ENCODE(DynamicZoneMemberListName_Struct, structs::DynamicZoneMemberListName_Struct);
OUT(client_id);
OUT(add_name);
@@ -628,7 +628,7 @@ namespace SoF
ENCODE(OP_DzMemberListStatus)
{
auto emu = reinterpret_cast<ExpeditionMemberList_Struct*>((*p)->pBuffer);
auto emu = reinterpret_cast<DynamicZoneMemberList_Struct*>((*p)->pBuffer);
if (emu->member_count == 1)
{
ENCODE_FORWARD(OP_DzMemberList);
@@ -1140,7 +1140,7 @@ namespace SoF
eq->level1 = emu->level;
// OUT(unknown00022[2]);
for (r = 0; r < 5; r++) {
OUT(binds[r].zoneId);
OUT(binds[r].zone_id);
OUT(binds[r].x);
OUT(binds[r].y);
OUT(binds[r].z);
+11 -11
View File
@@ -804,7 +804,7 @@ struct LeadershipAA_Struct {
* Size: 20 Octets
*/
struct BindStruct {
/*000*/ uint32 zoneId;
/*000*/ uint32 zone_id;
/*004*/ float x;
/*008*/ float y;
/*012*/ float z;
@@ -1742,7 +1742,7 @@ struct GMZoneRequest_Struct {
/*0068*/ float x;
/*0072*/ float y;
/*0076*/ float z;
/*0080*/ char unknown0080[4];
/*0080*/ float heading;
/*0084*/ uint32 success; // 0 if command failed, 1 if succeeded?
/*0088*/
// /*072*/ int8 success; // =0 client->server, =1 server->client, -X=specific error
@@ -4112,29 +4112,29 @@ struct ExpeditionInviteResponse_Struct
/*075*/ uint8 unknown079; // padding/garbage?
};
struct ExpeditionInfo_Struct
struct DynamicZoneInfo_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 assigned; // padded bool
/*008*/ uint32 max_players;
/*012*/ char expedition_name[128];
/*012*/ char dz_name[128];
/*140*/ char leader_name[64];
};
struct ExpeditionMemberEntry_Struct
struct DynamicZoneMemberEntry_Struct
{
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
/*000*/ uint8 expedition_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
/*000*/ uint8 online_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
};
struct ExpeditionMemberList_Struct
struct DynamicZoneMemberList_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 member_count;
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
/*008*/ DynamicZoneMemberEntry_Struct members[0]; // variable length
};
struct ExpeditionMemberListName_Struct
struct DynamicZoneMemberListName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
@@ -4156,7 +4156,7 @@ struct ExpeditionLockoutTimers_Struct
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
};
struct ExpeditionSetLeaderName_Struct
struct DynamicZoneLeaderName_Struct
{
/*000*/ uint32 client_id;
/*004*/ char leader_name[64];
+11 -11
View File
@@ -476,13 +476,13 @@ namespace Titanium
ENCODE(OP_DzExpeditionInfo)
{
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
ENCODE_LENGTH_EXACT(DynamicZoneInfo_Struct);
SETUP_DIRECT_ENCODE(DynamicZoneInfo_Struct, structs::DynamicZoneInfo_Struct);
OUT(client_id);
OUT(assigned);
OUT(max_players);
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strn0cpy(eq->dz_name, emu->dz_name, sizeof(eq->dz_name));
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
FINISH_ENCODE();
@@ -528,8 +528,8 @@ namespace Titanium
ENCODE(OP_DzSetLeaderName)
{
ENCODE_LENGTH_EXACT(ExpeditionSetLeaderName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionSetLeaderName_Struct, structs::ExpeditionSetLeaderName_Struct);
ENCODE_LENGTH_EXACT(DynamicZoneLeaderName_Struct);
SETUP_DIRECT_ENCODE(DynamicZoneLeaderName_Struct, structs::DynamicZoneLeaderName_Struct);
OUT(client_id);
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
@@ -539,7 +539,7 @@ namespace Titanium
ENCODE(OP_DzMemberList)
{
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
SETUP_VAR_ENCODE(DynamicZoneMemberList_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
@@ -547,7 +547,7 @@ namespace Titanium
for (uint32 i = 0; i < emu->member_count; ++i)
{
buf.WriteString(emu->members[i].name);
buf.WriteUInt8(emu->members[i].expedition_status);
buf.WriteUInt8(emu->members[i].online_status);
}
__packet->size = buf.size();
@@ -559,8 +559,8 @@ namespace Titanium
ENCODE(OP_DzMemberListName)
{
ENCODE_LENGTH_EXACT(ExpeditionMemberListName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionMemberListName_Struct, structs::ExpeditionMemberListName_Struct);
ENCODE_LENGTH_EXACT(DynamicZoneMemberListName_Struct);
SETUP_DIRECT_ENCODE(DynamicZoneMemberListName_Struct, structs::DynamicZoneMemberListName_Struct);
OUT(client_id);
OUT(add_name);
@@ -571,7 +571,7 @@ namespace Titanium
ENCODE(OP_DzMemberListStatus)
{
auto emu = reinterpret_cast<ExpeditionMemberList_Struct*>((*p)->pBuffer);
auto emu = reinterpret_cast<DynamicZoneMemberList_Struct*>((*p)->pBuffer);
if (emu->member_count == 1)
{
ENCODE_FORWARD(OP_DzMemberList);
@@ -1022,7 +1022,7 @@ namespace Titanium
eq->level1 = emu->level;
// OUT(unknown00022[2]);
for (r = 0; r < 5; r++) {
OUT(binds[r].zoneId);
OUT(binds[r].zone_id);
OUT(binds[r].x);
OUT(binds[r].y);
OUT(binds[r].z);
+11 -11
View File
@@ -738,7 +738,7 @@ struct LeadershipAA_Struct {
* Size: 20 Octets
*/
struct BindStruct {
/*000*/ uint32 zoneId;
/*000*/ uint32 zone_id;
/*004*/ float x;
/*008*/ float y;
/*012*/ float z;
@@ -1509,7 +1509,7 @@ struct GMZoneRequest_Struct {
/*0068*/ float x;
/*0072*/ float y;
/*0076*/ float z;
/*0080*/ char unknown0080[4];
/*0080*/ float heading;
/*0084*/ uint32 success; // 0 if command failed, 1 if succeeded?
/*0088*/
// /*072*/ int8 success; // =0 client->server, =1 server->client, -X=specific error
@@ -3323,29 +3323,29 @@ struct ExpeditionInviteResponse_Struct
/*075*/ uint8 unknown079; // padding/garbage?
};
struct ExpeditionInfo_Struct
struct DynamicZoneInfo_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 assigned; // padded bool
/*008*/ uint32 max_players;
/*012*/ char expedition_name[128];
/*012*/ char dz_name[128];
/*140*/ char leader_name[64];
};
struct ExpeditionMemberEntry_Struct
struct DynamicZoneMemberEntry_Struct
{
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
/*000*/ uint8 expedition_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
/*000*/ uint8 online_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
};
struct ExpeditionMemberList_Struct
struct DynamicZoneMemberList_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 member_count;
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
/*008*/ DynamicZoneMemberEntry_Struct members[0]; // variable length
};
struct ExpeditionMemberListName_Struct
struct DynamicZoneMemberListName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
@@ -3367,7 +3367,7 @@ struct ExpeditionLockoutTimers_Struct
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
};
struct ExpeditionSetLeaderName_Struct
struct DynamicZoneLeaderName_Struct
{
/*000*/ uint32 client_id;
/*004*/ char leader_name[64];
+11 -11
View File
@@ -675,13 +675,13 @@ namespace UF
ENCODE(OP_DzExpeditionInfo)
{
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
ENCODE_LENGTH_EXACT(DynamicZoneInfo_Struct);
SETUP_DIRECT_ENCODE(DynamicZoneInfo_Struct, structs::DynamicZoneInfo_Struct);
OUT(client_id);
OUT(assigned);
OUT(max_players);
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strn0cpy(eq->dz_name, emu->dz_name, sizeof(eq->dz_name));
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
FINISH_ENCODE();
@@ -727,8 +727,8 @@ namespace UF
ENCODE(OP_DzSetLeaderName)
{
ENCODE_LENGTH_EXACT(ExpeditionSetLeaderName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionSetLeaderName_Struct, structs::ExpeditionSetLeaderName_Struct);
ENCODE_LENGTH_EXACT(DynamicZoneLeaderName_Struct);
SETUP_DIRECT_ENCODE(DynamicZoneLeaderName_Struct, structs::DynamicZoneLeaderName_Struct);
OUT(client_id);
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
@@ -738,7 +738,7 @@ namespace UF
ENCODE(OP_DzMemberList)
{
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
SETUP_VAR_ENCODE(DynamicZoneMemberList_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
@@ -746,7 +746,7 @@ namespace UF
for (uint32 i = 0; i < emu->member_count; ++i)
{
buf.WriteString(emu->members[i].name);
buf.WriteUInt8(emu->members[i].expedition_status);
buf.WriteUInt8(emu->members[i].online_status);
}
__packet->size = buf.size();
@@ -758,8 +758,8 @@ namespace UF
ENCODE(OP_DzMemberListName)
{
ENCODE_LENGTH_EXACT(ExpeditionMemberListName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionMemberListName_Struct, structs::ExpeditionMemberListName_Struct);
ENCODE_LENGTH_EXACT(DynamicZoneMemberListName_Struct);
SETUP_DIRECT_ENCODE(DynamicZoneMemberListName_Struct, structs::DynamicZoneMemberListName_Struct);
OUT(client_id);
OUT(add_name);
@@ -770,7 +770,7 @@ namespace UF
ENCODE(OP_DzMemberListStatus)
{
auto emu = reinterpret_cast<ExpeditionMemberList_Struct*>((*p)->pBuffer);
auto emu = reinterpret_cast<DynamicZoneMemberList_Struct*>((*p)->pBuffer);
if (emu->member_count == 1)
{
ENCODE_FORWARD(OP_DzMemberList);
@@ -1705,7 +1705,7 @@ namespace UF
eq->level1 = emu->level;
// OUT(unknown00022[2]);
for (r = 0; r < 5; r++) {
OUT(binds[r].zoneId);
OUT(binds[r].zone_id);
OUT(binds[r].x);
OUT(binds[r].y);
OUT(binds[r].z);
+11 -11
View File
@@ -833,7 +833,7 @@ struct LeadershipAA_Struct {
* Size: 20 Octets
*/
struct BindStruct {
/*000*/ uint32 zoneId;
/*000*/ uint32 zone_id;
/*004*/ float x;
/*008*/ float y;
/*012*/ float z;
@@ -1755,7 +1755,7 @@ struct GMZoneRequest_Struct {
/*0068*/ float x;
/*0072*/ float y;
/*0076*/ float z;
/*0080*/ char unknown0080[4];
/*0080*/ float heading;
/*0084*/ uint32 success; // 0 if command failed, 1 if succeeded?
/*0088*/
// /*072*/ int8 success; // =0 client->server, =1 server->client, -X=specific error
@@ -4277,30 +4277,30 @@ struct ExpeditionInviteResponse_Struct
/*079*/ uint8 unknown079; // padding garbage?
};
struct ExpeditionInfo_Struct
struct DynamicZoneInfo_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 assigned; // padded bool
/*012*/ uint32 max_players;
/*016*/ char expedition_name[128];
/*016*/ char dz_name[128];
/*144*/ char leader_name[64];
};
struct ExpeditionMemberEntry_Struct
struct DynamicZoneMemberEntry_Struct
{
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
/*000*/ uint8 expedition_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
/*000*/ uint8 online_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
};
struct ExpeditionMemberList_Struct
struct DynamicZoneMemberList_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 member_count; // number of players in window
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
/*008*/ DynamicZoneMemberEntry_Struct members[0]; // variable length
};
struct ExpeditionMemberListName_Struct
struct DynamicZoneMemberListName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
@@ -4323,7 +4323,7 @@ struct ExpeditionLockoutTimers_Struct
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
};
struct ExpeditionSetLeaderName_Struct
struct DynamicZoneLeaderName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
+5 -5
View File
@@ -46,15 +46,15 @@ std::string GetPlatformName()
{
switch (GetExecutablePlatformInt()) {
case EQEmuExePlatform::ExePlatformWorld:
return "WorldServer";
return "World";
case EQEmuExePlatform::ExePlatformQueryServ:
return "QueryServer";
return "QS";
case EQEmuExePlatform::ExePlatformZone:
return "ZoneServer";
return "Zone";
case EQEmuExePlatform::ExePlatformUCS:
return "UCS";
case EQEmuExePlatform::ExePlatformLogin:
return "LoginServer";
return "Login";
case EQEmuExePlatform::ExePlatformSocket_Server:
return "SocketServer";
case EQEmuExePlatform::ExePlatformSharedMemory:
@@ -70,4 +70,4 @@ std::string GetPlatformName()
default:
return "";
}
}
}
-1
View File
@@ -860,7 +860,6 @@ uint16 GetRaceIDFromPlayerRaceBit(uint32 player_race_bit);
float GetRaceGenderDefaultHeight(int race, int gender);
// player race-/gender-based model feature validators
namespace PlayerAppearance
{
@@ -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_AA_ABILITY_REPOSITORY_H
@@ -81,21 +64,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("aa_ability");
@@ -115,7 +83,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -156,10 +124,11 @@ public:
}
static AaAbility FindOne(
Database& db,
int aa_ability_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -193,10 +162,11 @@ public:
}
static int DeleteOne(
Database& db,
int aa_ability_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -209,6 +179,7 @@ public:
}
static int UpdateOne(
Database& db,
AaAbility aa_ability_entry
)
{
@@ -231,7 +202,7 @@ public:
update_values.push_back(columns[12] + " = " + std::to_string(aa_ability_entry.enabled));
update_values.push_back(columns[13] + " = " + std::to_string(aa_ability_entry.reset_on_death));
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -245,6 +216,7 @@ public:
}
static AaAbility InsertOne(
Database& db,
AaAbility aa_ability_entry
)
{
@@ -265,7 +237,7 @@ public:
insert_values.push_back(std::to_string(aa_ability_entry.enabled));
insert_values.push_back(std::to_string(aa_ability_entry.reset_on_death));
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -284,6 +256,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<AaAbility> aa_ability_entries
)
{
@@ -312,7 +285,7 @@ public:
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -323,11 +296,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AaAbility> All()
static std::vector<AaAbility> All(Database& db)
{
std::vector<AaAbility> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -360,11 +333,11 @@ public:
return all_entries;
}
static std::vector<AaAbility> GetWhere(std::string where_filter)
static std::vector<AaAbility> GetWhere(Database& db, std::string where_filter)
{
std::vector<AaAbility> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -398,9 +371,9 @@ 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(),
@@ -411,9 +384,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_AA_RANK_EFFECTS_REPOSITORY_H
@@ -63,21 +46,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("aa_rank_effects");
@@ -97,7 +65,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -129,10 +97,11 @@ public:
}
static AaRankEffects FindOne(
Database& db,
int aa_rank_effects_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -157,10 +126,11 @@ public:
}
static int DeleteOne(
Database& db,
int aa_rank_effects_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -173,6 +143,7 @@ public:
}
static int UpdateOne(
Database& db,
AaRankEffects aa_rank_effects_entry
)
{
@@ -186,7 +157,7 @@ public:
update_values.push_back(columns[3] + " = " + std::to_string(aa_rank_effects_entry.base1));
update_values.push_back(columns[4] + " = " + std::to_string(aa_rank_effects_entry.base2));
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -200,6 +171,7 @@ public:
}
static AaRankEffects InsertOne(
Database& db,
AaRankEffects aa_rank_effects_entry
)
{
@@ -211,7 +183,7 @@ public:
insert_values.push_back(std::to_string(aa_rank_effects_entry.base1));
insert_values.push_back(std::to_string(aa_rank_effects_entry.base2));
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -230,6 +202,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<AaRankEffects> aa_rank_effects_entries
)
{
@@ -249,7 +222,7 @@ public:
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -260,11 +233,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AaRankEffects> All()
static std::vector<AaRankEffects> All(Database& db)
{
std::vector<AaRankEffects> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -288,11 +261,11 @@ public:
return all_entries;
}
static std::vector<AaRankEffects> GetWhere(std::string where_filter)
static std::vector<AaRankEffects> GetWhere(Database& db, std::string where_filter)
{
std::vector<AaRankEffects> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -317,9 +290,9 @@ 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(),
@@ -330,9 +303,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_AA_RANK_PREREQS_REPOSITORY_H
@@ -59,21 +42,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("aa_rank_prereqs");
@@ -93,7 +61,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -123,10 +91,11 @@ public:
}
static AaRankPrereqs FindOne(
Database& db,
int aa_rank_prereqs_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -149,10 +118,11 @@ public:
}
static int DeleteOne(
Database& db,
int aa_rank_prereqs_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -165,6 +135,7 @@ public:
}
static int UpdateOne(
Database& db,
AaRankPrereqs aa_rank_prereqs_entry
)
{
@@ -176,7 +147,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(aa_rank_prereqs_entry.aa_id));
update_values.push_back(columns[2] + " = " + std::to_string(aa_rank_prereqs_entry.points));
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -190,6 +161,7 @@ public:
}
static AaRankPrereqs InsertOne(
Database& db,
AaRankPrereqs aa_rank_prereqs_entry
)
{
@@ -199,7 +171,7 @@ public:
insert_values.push_back(std::to_string(aa_rank_prereqs_entry.aa_id));
insert_values.push_back(std::to_string(aa_rank_prereqs_entry.points));
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -218,6 +190,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<AaRankPrereqs> aa_rank_prereqs_entries
)
{
@@ -235,7 +208,7 @@ public:
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -246,11 +219,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AaRankPrereqs> All()
static std::vector<AaRankPrereqs> All(Database& db)
{
std::vector<AaRankPrereqs> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -272,11 +245,11 @@ public:
return all_entries;
}
static std::vector<AaRankPrereqs> GetWhere(std::string where_filter)
static std::vector<AaRankPrereqs> GetWhere(Database& db, std::string where_filter)
{
std::vector<AaRankPrereqs> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -299,9 +272,9 @@ 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(),
@@ -312,9 +285,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_AA_RANKS_REPOSITORY_H
@@ -79,21 +62,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("aa_ranks");
@@ -113,7 +81,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -153,10 +121,11 @@ public:
}
static AaRanks FindOne(
Database& db,
int aa_ranks_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -189,10 +158,11 @@ public:
}
static int DeleteOne(
Database& db,
int aa_ranks_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -205,6 +175,7 @@ public:
}
static int UpdateOne(
Database& db,
AaRanks aa_ranks_entry
)
{
@@ -226,7 +197,7 @@ public:
update_values.push_back(columns[11] + " = " + std::to_string(aa_ranks_entry.prev_id));
update_values.push_back(columns[12] + " = " + std::to_string(aa_ranks_entry.next_id));
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -240,6 +211,7 @@ public:
}
static AaRanks InsertOne(
Database& db,
AaRanks aa_ranks_entry
)
{
@@ -259,7 +231,7 @@ public:
insert_values.push_back(std::to_string(aa_ranks_entry.prev_id));
insert_values.push_back(std::to_string(aa_ranks_entry.next_id));
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -278,6 +250,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<AaRanks> aa_ranks_entries
)
{
@@ -305,7 +278,7 @@ public:
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -316,11 +289,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AaRanks> All()
static std::vector<AaRanks> All(Database& db)
{
std::vector<AaRanks> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -352,11 +325,11 @@ public:
return all_entries;
}
static std::vector<AaRanks> GetWhere(std::string where_filter)
static std::vector<AaRanks> GetWhere(Database& db, std::string where_filter)
{
std::vector<AaRanks> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -389,9 +362,9 @@ 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(),
@@ -402,9 +375,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_ACCOUNT_FLAGS_REPOSITORY_H
@@ -59,21 +42,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("account_flags");
@@ -93,7 +61,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -123,10 +91,11 @@ public:
}
static AccountFlags FindOne(
Database& db,
int account_flags_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -149,10 +118,11 @@ public:
}
static int DeleteOne(
Database& db,
int account_flags_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -165,6 +135,7 @@ public:
}
static int UpdateOne(
Database& db,
AccountFlags account_flags_entry
)
{
@@ -176,7 +147,7 @@ public:
update_values.push_back(columns[1] + " = '" + EscapeString(account_flags_entry.p_flag) + "'");
update_values.push_back(columns[2] + " = '" + EscapeString(account_flags_entry.p_value) + "'");
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -190,6 +161,7 @@ public:
}
static AccountFlags InsertOne(
Database& db,
AccountFlags account_flags_entry
)
{
@@ -199,7 +171,7 @@ public:
insert_values.push_back("'" + EscapeString(account_flags_entry.p_flag) + "'");
insert_values.push_back("'" + EscapeString(account_flags_entry.p_value) + "'");
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -218,6 +190,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<AccountFlags> account_flags_entries
)
{
@@ -235,7 +208,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -246,11 +219,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AccountFlags> All()
static std::vector<AccountFlags> All(Database& db)
{
std::vector<AccountFlags> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -272,11 +245,11 @@ public:
return all_entries;
}
static std::vector<AccountFlags> GetWhere(std::string where_filter)
static std::vector<AccountFlags> GetWhere(Database& db, std::string where_filter)
{
std::vector<AccountFlags> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -299,9 +272,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -312,9 +285,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_ACCOUNT_IP_REPOSITORY_H
@@ -61,21 +44,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("account_ip");
@@ -95,7 +63,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -126,10 +94,11 @@ public:
}
static AccountIp FindOne(
Database& db,
int account_ip_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -153,10 +122,11 @@ public:
}
static int DeleteOne(
Database& db,
int account_ip_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -169,6 +139,7 @@ public:
}
static int UpdateOne(
Database& db,
AccountIp account_ip_entry
)
{
@@ -181,7 +152,7 @@ public:
update_values.push_back(columns[2] + " = " + std::to_string(account_ip_entry.count));
update_values.push_back(columns[3] + " = '" + EscapeString(account_ip_entry.lastused) + "'");
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -195,6 +166,7 @@ public:
}
static AccountIp InsertOne(
Database& db,
AccountIp account_ip_entry
)
{
@@ -205,7 +177,7 @@ public:
insert_values.push_back(std::to_string(account_ip_entry.count));
insert_values.push_back("'" + EscapeString(account_ip_entry.lastused) + "'");
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -224,6 +196,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<AccountIp> account_ip_entries
)
{
@@ -242,7 +215,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -253,11 +226,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AccountIp> All()
static std::vector<AccountIp> All(Database& db)
{
std::vector<AccountIp> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -280,11 +253,11 @@ public:
return all_entries;
}
static std::vector<AccountIp> GetWhere(std::string where_filter)
static std::vector<AccountIp> GetWhere(Database& db, std::string where_filter)
{
std::vector<AccountIp> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -308,9 +281,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -321,9 +294,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_ACCOUNT_REPOSITORY_H
@@ -91,21 +74,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("account");
@@ -125,7 +93,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -171,10 +139,11 @@ public:
}
static Account FindOne(
Database& db,
int account_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -213,10 +182,11 @@ public:
}
static int DeleteOne(
Database& db,
int account_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -229,6 +199,7 @@ public:
}
static int UpdateOne(
Database& db,
Account account_entry
)
{
@@ -255,7 +226,7 @@ public:
update_values.push_back(columns[17] + " = '" + EscapeString(account_entry.ban_reason) + "'");
update_values.push_back(columns[18] + " = '" + EscapeString(account_entry.suspend_reason) + "'");
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -269,11 +240,13 @@ public:
}
static Account InsertOne(
Database& db,
Account account_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(account_entry.id));
insert_values.push_back("'" + EscapeString(account_entry.name) + "'");
insert_values.push_back("'" + EscapeString(account_entry.charname) + "'");
insert_values.push_back(std::to_string(account_entry.sharedplat));
@@ -293,7 +266,7 @@ public:
insert_values.push_back("'" + EscapeString(account_entry.ban_reason) + "'");
insert_values.push_back("'" + EscapeString(account_entry.suspend_reason) + "'");
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -312,6 +285,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<Account> account_entries
)
{
@@ -320,6 +294,7 @@ public:
for (auto &account_entry: account_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(account_entry.id));
insert_values.push_back("'" + EscapeString(account_entry.name) + "'");
insert_values.push_back("'" + EscapeString(account_entry.charname) + "'");
insert_values.push_back(std::to_string(account_entry.sharedplat));
@@ -344,7 +319,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -355,11 +330,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<Account> All()
static std::vector<Account> All(Database& db)
{
std::vector<Account> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -397,11 +372,11 @@ public:
return all_entries;
}
static std::vector<Account> GetWhere(std::string where_filter)
static std::vector<Account> GetWhere(Database& db, std::string where_filter)
{
std::vector<Account> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -440,9 +415,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -453,9 +428,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_ACCOUNT_REWARDS_REPOSITORY_H
@@ -59,21 +42,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("account_rewards");
@@ -93,7 +61,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -123,10 +91,11 @@ public:
}
static AccountRewards FindOne(
Database& db,
int account_rewards_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -149,10 +118,11 @@ public:
}
static int DeleteOne(
Database& db,
int account_rewards_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -165,6 +135,7 @@ public:
}
static int UpdateOne(
Database& db,
AccountRewards account_rewards_entry
)
{
@@ -176,7 +147,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(account_rewards_entry.reward_id));
update_values.push_back(columns[2] + " = " + std::to_string(account_rewards_entry.amount));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -190,6 +161,7 @@ public:
}
static AccountRewards InsertOne(
Database& db,
AccountRewards account_rewards_entry
)
{
@@ -199,7 +171,7 @@ public:
insert_values.push_back(std::to_string(account_rewards_entry.reward_id));
insert_values.push_back(std::to_string(account_rewards_entry.amount));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -218,6 +190,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<AccountRewards> account_rewards_entries
)
{
@@ -235,7 +208,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -246,11 +219,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AccountRewards> All()
static std::vector<AccountRewards> All(Database& db)
{
std::vector<AccountRewards> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -272,11 +245,11 @@ public:
return all_entries;
}
static std::vector<AccountRewards> GetWhere(std::string where_filter)
static std::vector<AccountRewards> GetWhere(Database& db, std::string where_filter)
{
std::vector<AccountRewards> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -299,9 +272,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -312,9 +285,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_ADVENTURE_DETAILS_REPOSITORY_H
@@ -71,21 +54,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("adventure_details");
@@ -105,7 +73,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -141,10 +109,11 @@ public:
}
static AdventureDetails FindOne(
Database& db,
int adventure_details_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -173,10 +142,11 @@ public:
}
static int DeleteOne(
Database& db,
int adventure_details_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -189,6 +159,7 @@ public:
}
static int UpdateOne(
Database& db,
AdventureDetails adventure_details_entry
)
{
@@ -205,7 +176,7 @@ public:
update_values.push_back(columns[7] + " = " + std::to_string(adventure_details_entry.time_zoned));
update_values.push_back(columns[8] + " = " + std::to_string(adventure_details_entry.time_completed));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -219,11 +190,13 @@ public:
}
static AdventureDetails InsertOne(
Database& db,
AdventureDetails adventure_details_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(adventure_details_entry.id));
insert_values.push_back(std::to_string(adventure_details_entry.adventure_id));
insert_values.push_back(std::to_string(adventure_details_entry.instance_id));
insert_values.push_back(std::to_string(adventure_details_entry.count));
@@ -233,7 +206,7 @@ public:
insert_values.push_back(std::to_string(adventure_details_entry.time_zoned));
insert_values.push_back(std::to_string(adventure_details_entry.time_completed));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -252,6 +225,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<AdventureDetails> adventure_details_entries
)
{
@@ -260,6 +234,7 @@ public:
for (auto &adventure_details_entry: adventure_details_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(adventure_details_entry.id));
insert_values.push_back(std::to_string(adventure_details_entry.adventure_id));
insert_values.push_back(std::to_string(adventure_details_entry.instance_id));
insert_values.push_back(std::to_string(adventure_details_entry.count));
@@ -274,7 +249,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -285,11 +260,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AdventureDetails> All()
static std::vector<AdventureDetails> All(Database& db)
{
std::vector<AdventureDetails> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -317,11 +292,11 @@ public:
return all_entries;
}
static std::vector<AdventureDetails> GetWhere(std::string where_filter)
static std::vector<AdventureDetails> GetWhere(Database& db, std::string where_filter)
{
std::vector<AdventureDetails> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -350,9 +325,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -363,9 +338,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_ADVENTURE_MEMBERS_REPOSITORY_H
@@ -57,21 +40,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("adventure_members");
@@ -91,7 +59,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -120,10 +88,11 @@ public:
}
static AdventureMembers FindOne(
Database& db,
int adventure_members_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -145,10 +114,11 @@ public:
}
static int DeleteOne(
Database& db,
int adventure_members_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -161,6 +131,7 @@ public:
}
static int UpdateOne(
Database& db,
AdventureMembers adventure_members_entry
)
{
@@ -171,7 +142,7 @@ public:
update_values.push_back(columns[0] + " = " + std::to_string(adventure_members_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(adventure_members_entry.charid));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -185,6 +156,7 @@ public:
}
static AdventureMembers InsertOne(
Database& db,
AdventureMembers adventure_members_entry
)
{
@@ -193,7 +165,7 @@ public:
insert_values.push_back(std::to_string(adventure_members_entry.id));
insert_values.push_back(std::to_string(adventure_members_entry.charid));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -212,6 +184,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<AdventureMembers> adventure_members_entries
)
{
@@ -228,7 +201,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -239,11 +212,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AdventureMembers> All()
static std::vector<AdventureMembers> All(Database& db)
{
std::vector<AdventureMembers> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -264,11 +237,11 @@ public:
return all_entries;
}
static std::vector<AdventureMembers> GetWhere(std::string where_filter)
static std::vector<AdventureMembers> GetWhere(Database& db, std::string where_filter)
{
std::vector<AdventureMembers> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -290,9 +263,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -303,9 +276,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_ADVENTURE_STATS_REPOSITORY_H
@@ -75,21 +58,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("adventure_stats");
@@ -109,7 +77,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -147,10 +115,11 @@ public:
}
static AdventureStats FindOne(
Database& db,
int adventure_stats_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -181,10 +150,11 @@ public:
}
static int DeleteOne(
Database& db,
int adventure_stats_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -197,6 +167,7 @@ public:
}
static int UpdateOne(
Database& db,
AdventureStats adventure_stats_entry
)
{
@@ -216,7 +187,7 @@ public:
update_values.push_back(columns[9] + " = " + std::to_string(adventure_stats_entry.ruj_losses));
update_values.push_back(columns[10] + " = " + std::to_string(adventure_stats_entry.tak_losses));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -230,6 +201,7 @@ public:
}
static AdventureStats InsertOne(
Database& db,
AdventureStats adventure_stats_entry
)
{
@@ -247,7 +219,7 @@ public:
insert_values.push_back(std::to_string(adventure_stats_entry.ruj_losses));
insert_values.push_back(std::to_string(adventure_stats_entry.tak_losses));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -266,6 +238,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<AdventureStats> adventure_stats_entries
)
{
@@ -291,7 +264,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -302,11 +275,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AdventureStats> All()
static std::vector<AdventureStats> All(Database& db)
{
std::vector<AdventureStats> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -336,11 +309,11 @@ public:
return all_entries;
}
static std::vector<AdventureStats> GetWhere(std::string where_filter)
static std::vector<AdventureStats> GetWhere(Database& db, std::string where_filter)
{
std::vector<AdventureStats> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -371,9 +344,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -384,9 +357,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_ADVENTURE_TEMPLATE_ENTRY_FLAVOR_REPOSITORY_H
@@ -57,21 +40,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("adventure_template_entry_flavor");
@@ -91,7 +59,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -120,10 +88,11 @@ public:
}
static AdventureTemplateEntryFlavor FindOne(
Database& db,
int adventure_template_entry_flavor_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -145,10 +114,11 @@ public:
}
static int DeleteOne(
Database& db,
int adventure_template_entry_flavor_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -161,6 +131,7 @@ public:
}
static int UpdateOne(
Database& db,
AdventureTemplateEntryFlavor adventure_template_entry_flavor_entry
)
{
@@ -171,7 +142,7 @@ public:
update_values.push_back(columns[0] + " = " + std::to_string(adventure_template_entry_flavor_entry.id));
update_values.push_back(columns[1] + " = '" + EscapeString(adventure_template_entry_flavor_entry.text) + "'");
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -185,6 +156,7 @@ public:
}
static AdventureTemplateEntryFlavor InsertOne(
Database& db,
AdventureTemplateEntryFlavor adventure_template_entry_flavor_entry
)
{
@@ -193,7 +165,7 @@ public:
insert_values.push_back(std::to_string(adventure_template_entry_flavor_entry.id));
insert_values.push_back("'" + EscapeString(adventure_template_entry_flavor_entry.text) + "'");
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -212,6 +184,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<AdventureTemplateEntryFlavor> adventure_template_entry_flavor_entries
)
{
@@ -228,7 +201,7 @@ public:
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -239,11 +212,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AdventureTemplateEntryFlavor> All()
static std::vector<AdventureTemplateEntryFlavor> All(Database& db)
{
std::vector<AdventureTemplateEntryFlavor> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -264,11 +237,11 @@ public:
return all_entries;
}
static std::vector<AdventureTemplateEntryFlavor> GetWhere(std::string where_filter)
static std::vector<AdventureTemplateEntryFlavor> GetWhere(Database& db, std::string where_filter)
{
std::vector<AdventureTemplateEntryFlavor> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -290,9 +263,9 @@ 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(),
@@ -303,9 +276,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_ADVENTURE_TEMPLATE_ENTRY_REPOSITORY_H
@@ -57,21 +40,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("adventure_template_entry");
@@ -91,7 +59,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -120,10 +88,11 @@ public:
}
static AdventureTemplateEntry FindOne(
Database& db,
int adventure_template_entry_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -145,10 +114,11 @@ public:
}
static int DeleteOne(
Database& db,
int adventure_template_entry_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -161,6 +131,7 @@ public:
}
static int UpdateOne(
Database& db,
AdventureTemplateEntry adventure_template_entry_entry
)
{
@@ -171,7 +142,7 @@ public:
update_values.push_back(columns[0] + " = " + std::to_string(adventure_template_entry_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(adventure_template_entry_entry.template_id));
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -185,6 +156,7 @@ public:
}
static AdventureTemplateEntry InsertOne(
Database& db,
AdventureTemplateEntry adventure_template_entry_entry
)
{
@@ -193,7 +165,7 @@ public:
insert_values.push_back(std::to_string(adventure_template_entry_entry.id));
insert_values.push_back(std::to_string(adventure_template_entry_entry.template_id));
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -212,6 +184,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<AdventureTemplateEntry> adventure_template_entry_entries
)
{
@@ -228,7 +201,7 @@ public:
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -239,11 +212,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AdventureTemplateEntry> All()
static std::vector<AdventureTemplateEntry> All(Database& db)
{
std::vector<AdventureTemplateEntry> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -264,11 +237,11 @@ public:
return all_entries;
}
static std::vector<AdventureTemplateEntry> GetWhere(std::string where_filter)
static std::vector<AdventureTemplateEntry> GetWhere(Database& db, std::string where_filter)
{
std::vector<AdventureTemplateEntry> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -290,9 +263,9 @@ 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(),
@@ -303,9 +276,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_ADVENTURE_TEMPLATE_REPOSITORY_H
@@ -119,21 +102,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("adventure_template");
@@ -153,7 +121,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -213,10 +181,11 @@ public:
}
static AdventureTemplate FindOne(
Database& db,
int adventure_template_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -269,10 +238,11 @@ public:
}
static int DeleteOne(
Database& db,
int adventure_template_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -285,6 +255,7 @@ public:
}
static int UpdateOne(
Database& db,
AdventureTemplate adventure_template_entry
)
{
@@ -326,7 +297,7 @@ public:
update_values.push_back(columns[31] + " = " + std::to_string(adventure_template_entry.graveyard_z));
update_values.push_back(columns[32] + " = " + std::to_string(adventure_template_entry.graveyard_radius));
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -340,6 +311,7 @@ public:
}
static AdventureTemplate InsertOne(
Database& db,
AdventureTemplate adventure_template_entry
)
{
@@ -379,7 +351,7 @@ public:
insert_values.push_back(std::to_string(adventure_template_entry.graveyard_z));
insert_values.push_back(std::to_string(adventure_template_entry.graveyard_radius));
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -398,6 +370,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<AdventureTemplate> adventure_template_entries
)
{
@@ -445,7 +418,7 @@ public:
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -456,11 +429,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AdventureTemplate> All()
static std::vector<AdventureTemplate> All(Database& db)
{
std::vector<AdventureTemplate> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -512,11 +485,11 @@ public:
return all_entries;
}
static std::vector<AdventureTemplate> GetWhere(std::string where_filter)
static std::vector<AdventureTemplate> GetWhere(Database& db, std::string where_filter)
{
std::vector<AdventureTemplate> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -569,9 +542,9 @@ 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(),
@@ -582,9 +555,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_ALTERNATE_CURRENCY_REPOSITORY_H
@@ -57,21 +40,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("alternate_currency");
@@ -91,7 +59,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -120,10 +88,11 @@ public:
}
static AlternateCurrency FindOne(
Database& db,
int alternate_currency_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -145,10 +114,11 @@ public:
}
static int DeleteOne(
Database& db,
int alternate_currency_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -161,6 +131,7 @@ public:
}
static int UpdateOne(
Database& db,
AlternateCurrency alternate_currency_entry
)
{
@@ -171,7 +142,7 @@ public:
update_values.push_back(columns[0] + " = " + std::to_string(alternate_currency_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(alternate_currency_entry.item_id));
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -185,6 +156,7 @@ public:
}
static AlternateCurrency InsertOne(
Database& db,
AlternateCurrency alternate_currency_entry
)
{
@@ -193,7 +165,7 @@ public:
insert_values.push_back(std::to_string(alternate_currency_entry.id));
insert_values.push_back(std::to_string(alternate_currency_entry.item_id));
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -212,6 +184,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<AlternateCurrency> alternate_currency_entries
)
{
@@ -228,7 +201,7 @@ public:
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -239,11 +212,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AlternateCurrency> All()
static std::vector<AlternateCurrency> All(Database& db)
{
std::vector<AlternateCurrency> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -264,11 +237,11 @@ public:
return all_entries;
}
static std::vector<AlternateCurrency> GetWhere(std::string where_filter)
static std::vector<AlternateCurrency> GetWhere(Database& db, std::string where_filter)
{
std::vector<AlternateCurrency> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -290,9 +263,9 @@ 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(),
@@ -303,9 +276,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_AURAS_REPOSITORY_H
@@ -75,21 +58,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("auras");
@@ -109,7 +77,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -147,10 +115,11 @@ public:
}
static Auras FindOne(
Database& db,
int auras_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -181,10 +150,11 @@ public:
}
static int DeleteOne(
Database& db,
int auras_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -197,6 +167,7 @@ public:
}
static int UpdateOne(
Database& db,
Auras auras_entry
)
{
@@ -216,7 +187,7 @@ public:
update_values.push_back(columns[9] + " = " + std::to_string(auras_entry.icon));
update_values.push_back(columns[10] + " = " + std::to_string(auras_entry.cast_time));
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -230,6 +201,7 @@ public:
}
static Auras InsertOne(
Database& db,
Auras auras_entry
)
{
@@ -247,7 +219,7 @@ public:
insert_values.push_back(std::to_string(auras_entry.icon));
insert_values.push_back(std::to_string(auras_entry.cast_time));
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -266,6 +238,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<Auras> auras_entries
)
{
@@ -291,7 +264,7 @@ public:
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -302,11 +275,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<Auras> All()
static std::vector<Auras> All(Database& db)
{
std::vector<Auras> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -336,11 +309,11 @@ public:
return all_entries;
}
static std::vector<Auras> GetWhere(std::string where_filter)
static std::vector<Auras> GetWhere(Database& db, std::string where_filter)
{
std::vector<Auras> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -371,9 +344,9 @@ 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(),
@@ -384,9 +357,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_BASE_DATA_REPOSITORY_H
@@ -73,21 +56,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("base_data");
@@ -107,7 +75,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -144,10 +112,11 @@ public:
}
static BaseData FindOne(
Database& db,
int base_data_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -177,10 +146,11 @@ public:
}
static int DeleteOne(
Database& db,
int base_data_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -193,6 +163,7 @@ public:
}
static int UpdateOne(
Database& db,
BaseData base_data_entry
)
{
@@ -211,7 +182,7 @@ public:
update_values.push_back(columns[8] + " = " + std::to_string(base_data_entry.mana_fac));
update_values.push_back(columns[9] + " = " + std::to_string(base_data_entry.end_fac));
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -225,6 +196,7 @@ public:
}
static BaseData InsertOne(
Database& db,
BaseData base_data_entry
)
{
@@ -241,7 +213,7 @@ public:
insert_values.push_back(std::to_string(base_data_entry.mana_fac));
insert_values.push_back(std::to_string(base_data_entry.end_fac));
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -260,6 +232,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<BaseData> base_data_entries
)
{
@@ -284,7 +257,7 @@ public:
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -295,11 +268,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<BaseData> All()
static std::vector<BaseData> All(Database& db)
{
std::vector<BaseData> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -328,11 +301,11 @@ public:
return all_entries;
}
static std::vector<BaseData> GetWhere(std::string where_filter)
static std::vector<BaseData> GetWhere(Database& db, std::string where_filter)
{
std::vector<BaseData> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -362,9 +335,9 @@ 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(),
@@ -375,9 +348,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_BLOCKED_SPELLS_REPOSITORY_H
@@ -77,21 +60,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("blocked_spells");
@@ -111,7 +79,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -150,10 +118,11 @@ public:
}
static BlockedSpells FindOne(
Database& db,
int blocked_spells_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -185,10 +154,11 @@ public:
}
static int DeleteOne(
Database& db,
int blocked_spells_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -201,6 +171,7 @@ public:
}
static int UpdateOne(
Database& db,
BlockedSpells blocked_spells_entry
)
{
@@ -220,7 +191,7 @@ public:
update_values.push_back(columns[10] + " = '" + EscapeString(blocked_spells_entry.message) + "'");
update_values.push_back(columns[11] + " = '" + EscapeString(blocked_spells_entry.description) + "'");
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -234,11 +205,13 @@ public:
}
static BlockedSpells InsertOne(
Database& db,
BlockedSpells blocked_spells_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(blocked_spells_entry.id));
insert_values.push_back(std::to_string(blocked_spells_entry.spellid));
insert_values.push_back(std::to_string(blocked_spells_entry.type));
insert_values.push_back(std::to_string(blocked_spells_entry.zoneid));
@@ -251,7 +224,7 @@ public:
insert_values.push_back("'" + EscapeString(blocked_spells_entry.message) + "'");
insert_values.push_back("'" + EscapeString(blocked_spells_entry.description) + "'");
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -270,6 +243,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<BlockedSpells> blocked_spells_entries
)
{
@@ -278,6 +252,7 @@ public:
for (auto &blocked_spells_entry: blocked_spells_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(blocked_spells_entry.id));
insert_values.push_back(std::to_string(blocked_spells_entry.spellid));
insert_values.push_back(std::to_string(blocked_spells_entry.type));
insert_values.push_back(std::to_string(blocked_spells_entry.zoneid));
@@ -295,7 +270,7 @@ public:
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -306,11 +281,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<BlockedSpells> All()
static std::vector<BlockedSpells> All(Database& db)
{
std::vector<BlockedSpells> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -341,11 +316,11 @@ public:
return all_entries;
}
static std::vector<BlockedSpells> GetWhere(std::string where_filter)
static std::vector<BlockedSpells> GetWhere(Database& db, std::string where_filter)
{
std::vector<BlockedSpells> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -377,9 +352,9 @@ 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(),
@@ -390,9 +365,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_BUG_REPORTS_REPOSITORY_H
@@ -117,21 +100,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("bug_reports");
@@ -151,7 +119,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -210,10 +178,11 @@ public:
}
static BugReports FindOne(
Database& db,
int bug_reports_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -265,10 +234,11 @@ public:
}
static int DeleteOne(
Database& db,
int bug_reports_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -281,6 +251,7 @@ public:
}
static int UpdateOne(
Database& db,
BugReports bug_reports_entry
)
{
@@ -320,7 +291,7 @@ public:
update_values.push_back(columns[30] + " = '" + EscapeString(bug_reports_entry.last_reviewer) + "'");
update_values.push_back(columns[31] + " = '" + EscapeString(bug_reports_entry.reviewer_notes) + "'");
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -334,11 +305,13 @@ public:
}
static BugReports InsertOne(
Database& db,
BugReports bug_reports_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(bug_reports_entry.id));
insert_values.push_back("'" + EscapeString(bug_reports_entry.zone) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.client_version_id));
insert_values.push_back("'" + EscapeString(bug_reports_entry.client_version_name) + "'");
@@ -371,7 +344,7 @@ public:
insert_values.push_back("'" + EscapeString(bug_reports_entry.last_reviewer) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.reviewer_notes) + "'");
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -390,6 +363,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<BugReports> bug_reports_entries
)
{
@@ -398,6 +372,7 @@ public:
for (auto &bug_reports_entry: bug_reports_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(bug_reports_entry.id));
insert_values.push_back("'" + EscapeString(bug_reports_entry.zone) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.client_version_id));
insert_values.push_back("'" + EscapeString(bug_reports_entry.client_version_name) + "'");
@@ -435,7 +410,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -446,11 +421,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<BugReports> All()
static std::vector<BugReports> All(Database& db)
{
std::vector<BugReports> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -501,11 +476,11 @@ public:
return all_entries;
}
static std::vector<BugReports> GetWhere(std::string where_filter)
static std::vector<BugReports> GetWhere(Database& db, std::string where_filter)
{
std::vector<BugReports> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -557,9 +532,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -570,9 +545,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
+27 -52
View File
@@ -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_BUGS_REPOSITORY_H
@@ -79,21 +62,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("bugs");
@@ -113,7 +81,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -153,10 +121,11 @@ public:
}
static Bugs FindOne(
Database& db,
int bugs_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -189,10 +158,11 @@ public:
}
static int DeleteOne(
Database& db,
int bugs_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -205,6 +175,7 @@ public:
}
static int UpdateOne(
Database& db,
Bugs bugs_entry
)
{
@@ -225,7 +196,7 @@ public:
update_values.push_back(columns[11] + " = '" + EscapeString(bugs_entry.date) + "'");
update_values.push_back(columns[12] + " = " + std::to_string(bugs_entry.status));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -239,11 +210,13 @@ public:
}
static Bugs InsertOne(
Database& db,
Bugs bugs_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(bugs_entry.id));
insert_values.push_back("'" + EscapeString(bugs_entry.zone) + "'");
insert_values.push_back("'" + EscapeString(bugs_entry.name) + "'");
insert_values.push_back("'" + EscapeString(bugs_entry.ui) + "'");
@@ -257,7 +230,7 @@ public:
insert_values.push_back("'" + EscapeString(bugs_entry.date) + "'");
insert_values.push_back(std::to_string(bugs_entry.status));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -276,6 +249,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<Bugs> bugs_entries
)
{
@@ -284,6 +258,7 @@ public:
for (auto &bugs_entry: bugs_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(bugs_entry.id));
insert_values.push_back("'" + EscapeString(bugs_entry.zone) + "'");
insert_values.push_back("'" + EscapeString(bugs_entry.name) + "'");
insert_values.push_back("'" + EscapeString(bugs_entry.ui) + "'");
@@ -302,7 +277,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -313,11 +288,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<Bugs> All()
static std::vector<Bugs> All(Database& db)
{
std::vector<Bugs> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -349,11 +324,11 @@ public:
return all_entries;
}
static std::vector<Bugs> GetWhere(std::string where_filter)
static std::vector<Bugs> GetWhere(Database& db, std::string where_filter)
{
std::vector<Bugs> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -386,9 +361,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -399,9 +374,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_BUYER_REPOSITORY_H
@@ -65,21 +48,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("buyer");
@@ -99,7 +67,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -132,10 +100,11 @@ public:
}
static Buyer FindOne(
Database& db,
int buyer_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -161,10 +130,11 @@ public:
}
static int DeleteOne(
Database& db,
int buyer_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -177,6 +147,7 @@ public:
}
static int UpdateOne(
Database& db,
Buyer buyer_entry
)
{
@@ -191,7 +162,7 @@ public:
update_values.push_back(columns[4] + " = " + std::to_string(buyer_entry.quantity));
update_values.push_back(columns[5] + " = " + std::to_string(buyer_entry.price));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -205,6 +176,7 @@ public:
}
static Buyer InsertOne(
Database& db,
Buyer buyer_entry
)
{
@@ -217,7 +189,7 @@ public:
insert_values.push_back(std::to_string(buyer_entry.quantity));
insert_values.push_back(std::to_string(buyer_entry.price));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -236,6 +208,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<Buyer> buyer_entries
)
{
@@ -256,7 +229,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -267,11 +240,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<Buyer> All()
static std::vector<Buyer> All(Database& db)
{
std::vector<Buyer> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -296,11 +269,11 @@ public:
return all_entries;
}
static std::vector<Buyer> GetWhere(std::string where_filter)
static std::vector<Buyer> GetWhere(Database& db, std::string where_filter)
{
std::vector<Buyer> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -326,9 +299,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -339,9 +312,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_CHAR_CREATE_COMBINATIONS_REPOSITORY_H
@@ -65,21 +48,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("char_create_combinations");
@@ -99,7 +67,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -132,10 +100,11 @@ public:
}
static CharCreateCombinations FindOne(
Database& db,
int char_create_combinations_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -161,10 +130,11 @@ public:
}
static int DeleteOne(
Database& db,
int char_create_combinations_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -177,6 +147,7 @@ public:
}
static int UpdateOne(
Database& db,
CharCreateCombinations char_create_combinations_entry
)
{
@@ -191,7 +162,7 @@ public:
update_values.push_back(columns[4] + " = " + std::to_string(char_create_combinations_entry.start_zone));
update_values.push_back(columns[5] + " = " + std::to_string(char_create_combinations_entry.expansions_req));
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -205,6 +176,7 @@ public:
}
static CharCreateCombinations InsertOne(
Database& db,
CharCreateCombinations char_create_combinations_entry
)
{
@@ -217,7 +189,7 @@ public:
insert_values.push_back(std::to_string(char_create_combinations_entry.start_zone));
insert_values.push_back(std::to_string(char_create_combinations_entry.expansions_req));
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -236,6 +208,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharCreateCombinations> char_create_combinations_entries
)
{
@@ -256,7 +229,7 @@ public:
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -267,11 +240,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharCreateCombinations> All()
static std::vector<CharCreateCombinations> All(Database& db)
{
std::vector<CharCreateCombinations> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -296,11 +269,11 @@ public:
return all_entries;
}
static std::vector<CharCreateCombinations> GetWhere(std::string where_filter)
static std::vector<CharCreateCombinations> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharCreateCombinations> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -326,9 +299,9 @@ 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(),
@@ -339,9 +312,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_CHAR_CREATE_POINT_ALLOCATIONS_REPOSITORY_H
@@ -83,21 +66,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("char_create_point_allocations");
@@ -117,7 +85,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -159,10 +127,11 @@ public:
}
static CharCreatePointAllocations FindOne(
Database& db,
int char_create_point_allocations_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -197,10 +166,11 @@ public:
}
static int DeleteOne(
Database& db,
int char_create_point_allocations_id
)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -213,6 +183,7 @@ public:
}
static int UpdateOne(
Database& db,
CharCreatePointAllocations char_create_point_allocations_entry
)
{
@@ -236,7 +207,7 @@ public:
update_values.push_back(columns[13] + " = " + std::to_string(char_create_point_allocations_entry.alloc_wis));
update_values.push_back(columns[14] + " = " + std::to_string(char_create_point_allocations_entry.alloc_cha));
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -250,6 +221,7 @@ public:
}
static CharCreatePointAllocations InsertOne(
Database& db,
CharCreatePointAllocations char_create_point_allocations_entry
)
{
@@ -271,7 +243,7 @@ public:
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_wis));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_cha));
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -290,6 +262,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharCreatePointAllocations> char_create_point_allocations_entries
)
{
@@ -319,7 +292,7 @@ public:
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -330,11 +303,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharCreatePointAllocations> All()
static std::vector<CharCreatePointAllocations> All(Database& db)
{
std::vector<CharCreatePointAllocations> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -368,11 +341,11 @@ public:
return all_entries;
}
static std::vector<CharCreatePointAllocations> GetWhere(std::string where_filter)
static std::vector<CharCreatePointAllocations> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharCreatePointAllocations> all_entries;
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -407,9 +380,9 @@ 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(),
@@ -420,9 +393,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = content_db.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_CHAR_RECIPE_LIST_REPOSITORY_H
@@ -59,21 +42,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("char_recipe_list");
@@ -93,7 +61,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -123,10 +91,11 @@ public:
}
static CharRecipeList FindOne(
Database& db,
int char_recipe_list_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -149,10 +118,11 @@ public:
}
static int DeleteOne(
Database& db,
int char_recipe_list_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -165,6 +135,7 @@ public:
}
static int UpdateOne(
Database& db,
CharRecipeList char_recipe_list_entry
)
{
@@ -176,7 +147,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(char_recipe_list_entry.recipe_id));
update_values.push_back(columns[2] + " = " + std::to_string(char_recipe_list_entry.madecount));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -190,6 +161,7 @@ public:
}
static CharRecipeList InsertOne(
Database& db,
CharRecipeList char_recipe_list_entry
)
{
@@ -199,7 +171,7 @@ public:
insert_values.push_back(std::to_string(char_recipe_list_entry.recipe_id));
insert_values.push_back(std::to_string(char_recipe_list_entry.madecount));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -218,6 +190,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharRecipeList> char_recipe_list_entries
)
{
@@ -235,7 +208,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -246,11 +219,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharRecipeList> All()
static std::vector<CharRecipeList> All(Database& db)
{
std::vector<CharRecipeList> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -272,11 +245,11 @@ public:
return all_entries;
}
static std::vector<CharRecipeList> GetWhere(std::string where_filter)
static std::vector<CharRecipeList> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharRecipeList> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -299,9 +272,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -312,9 +285,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_CHARACTER_ACTIVITIES_REPOSITORY_H
@@ -63,21 +46,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("character_activities");
@@ -97,7 +65,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -129,10 +97,11 @@ public:
}
static CharacterActivities FindOne(
Database& db,
int character_activities_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -157,10 +126,11 @@ public:
}
static int DeleteOne(
Database& db,
int character_activities_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -173,6 +143,7 @@ public:
}
static int UpdateOne(
Database& db,
CharacterActivities character_activities_entry
)
{
@@ -186,7 +157,7 @@ public:
update_values.push_back(columns[3] + " = " + std::to_string(character_activities_entry.donecount));
update_values.push_back(columns[4] + " = " + std::to_string(character_activities_entry.completed));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -200,6 +171,7 @@ public:
}
static CharacterActivities InsertOne(
Database& db,
CharacterActivities character_activities_entry
)
{
@@ -211,7 +183,7 @@ public:
insert_values.push_back(std::to_string(character_activities_entry.donecount));
insert_values.push_back(std::to_string(character_activities_entry.completed));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -230,6 +202,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharacterActivities> character_activities_entries
)
{
@@ -249,7 +222,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -260,11 +233,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterActivities> All()
static std::vector<CharacterActivities> All(Database& db)
{
std::vector<CharacterActivities> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -288,11 +261,11 @@ public:
return all_entries;
}
static std::vector<CharacterActivities> GetWhere(std::string where_filter)
static std::vector<CharacterActivities> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterActivities> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -317,9 +290,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -330,9 +303,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_CHARACTER_ALT_CURRENCY_REPOSITORY_H
@@ -59,21 +42,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("character_alt_currency");
@@ -93,7 +61,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -123,10 +91,11 @@ public:
}
static CharacterAltCurrency FindOne(
Database& db,
int character_alt_currency_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -149,10 +118,11 @@ public:
}
static int DeleteOne(
Database& db,
int character_alt_currency_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -165,6 +135,7 @@ public:
}
static int UpdateOne(
Database& db,
CharacterAltCurrency character_alt_currency_entry
)
{
@@ -176,7 +147,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_alt_currency_entry.currency_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_alt_currency_entry.amount));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -190,6 +161,7 @@ public:
}
static CharacterAltCurrency InsertOne(
Database& db,
CharacterAltCurrency character_alt_currency_entry
)
{
@@ -199,7 +171,7 @@ public:
insert_values.push_back(std::to_string(character_alt_currency_entry.currency_id));
insert_values.push_back(std::to_string(character_alt_currency_entry.amount));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -218,6 +190,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharacterAltCurrency> character_alt_currency_entries
)
{
@@ -235,7 +208,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -246,11 +219,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterAltCurrency> All()
static std::vector<CharacterAltCurrency> All(Database& db)
{
std::vector<CharacterAltCurrency> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -272,11 +245,11 @@ public:
return all_entries;
}
static std::vector<CharacterAltCurrency> GetWhere(std::string where_filter)
static std::vector<CharacterAltCurrency> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterAltCurrency> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -299,9 +272,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -312,9 +285,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_CHARACTER_ALTERNATE_ABILITIES_REPOSITORY_H
@@ -61,21 +44,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("character_alternate_abilities");
@@ -95,7 +63,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -126,10 +94,11 @@ public:
}
static CharacterAlternateAbilities FindOne(
Database& db,
int character_alternate_abilities_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -153,10 +122,11 @@ public:
}
static int DeleteOne(
Database& db,
int character_alternate_abilities_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -169,6 +139,7 @@ public:
}
static int UpdateOne(
Database& db,
CharacterAlternateAbilities character_alternate_abilities_entry
)
{
@@ -181,7 +152,7 @@ public:
update_values.push_back(columns[2] + " = " + std::to_string(character_alternate_abilities_entry.aa_value));
update_values.push_back(columns[3] + " = " + std::to_string(character_alternate_abilities_entry.charges));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -195,6 +166,7 @@ public:
}
static CharacterAlternateAbilities InsertOne(
Database& db,
CharacterAlternateAbilities character_alternate_abilities_entry
)
{
@@ -205,7 +177,7 @@ public:
insert_values.push_back(std::to_string(character_alternate_abilities_entry.aa_value));
insert_values.push_back(std::to_string(character_alternate_abilities_entry.charges));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -224,6 +196,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharacterAlternateAbilities> character_alternate_abilities_entries
)
{
@@ -242,7 +215,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -253,11 +226,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterAlternateAbilities> All()
static std::vector<CharacterAlternateAbilities> All(Database& db)
{
std::vector<CharacterAlternateAbilities> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -280,11 +253,11 @@ public:
return all_entries;
}
static std::vector<CharacterAlternateAbilities> GetWhere(std::string where_filter)
static std::vector<CharacterAlternateAbilities> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterAlternateAbilities> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -308,9 +281,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -321,9 +294,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_CHARACTER_AURAS_REPOSITORY_H
@@ -59,21 +42,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("character_auras");
@@ -93,7 +61,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -123,10 +91,11 @@ public:
}
static CharacterAuras FindOne(
Database& db,
int character_auras_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -149,10 +118,11 @@ public:
}
static int DeleteOne(
Database& db,
int character_auras_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -165,6 +135,7 @@ public:
}
static int UpdateOne(
Database& db,
CharacterAuras character_auras_entry
)
{
@@ -176,7 +147,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_auras_entry.slot));
update_values.push_back(columns[2] + " = " + std::to_string(character_auras_entry.spell_id));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -190,6 +161,7 @@ public:
}
static CharacterAuras InsertOne(
Database& db,
CharacterAuras character_auras_entry
)
{
@@ -199,7 +171,7 @@ public:
insert_values.push_back(std::to_string(character_auras_entry.slot));
insert_values.push_back(std::to_string(character_auras_entry.spell_id));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -218,6 +190,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharacterAuras> character_auras_entries
)
{
@@ -235,7 +208,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -246,11 +219,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterAuras> All()
static std::vector<CharacterAuras> All(Database& db)
{
std::vector<CharacterAuras> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -272,11 +245,11 @@ public:
return all_entries;
}
static std::vector<CharacterAuras> GetWhere(std::string where_filter)
static std::vector<CharacterAuras> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterAuras> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -299,9 +272,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -312,9 +285,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_CHARACTER_BANDOLIER_REPOSITORY_H
@@ -65,21 +48,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("character_bandolier");
@@ -99,7 +67,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -132,10 +100,11 @@ public:
}
static CharacterBandolier FindOne(
Database& db,
int character_bandolier_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -161,10 +130,11 @@ public:
}
static int DeleteOne(
Database& db,
int character_bandolier_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -177,6 +147,7 @@ public:
}
static int UpdateOne(
Database& db,
CharacterBandolier character_bandolier_entry
)
{
@@ -191,7 +162,7 @@ public:
update_values.push_back(columns[4] + " = " + std::to_string(character_bandolier_entry.icon));
update_values.push_back(columns[5] + " = '" + EscapeString(character_bandolier_entry.bandolier_name) + "'");
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -205,6 +176,7 @@ public:
}
static CharacterBandolier InsertOne(
Database& db,
CharacterBandolier character_bandolier_entry
)
{
@@ -217,7 +189,7 @@ public:
insert_values.push_back(std::to_string(character_bandolier_entry.icon));
insert_values.push_back("'" + EscapeString(character_bandolier_entry.bandolier_name) + "'");
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -236,6 +208,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharacterBandolier> character_bandolier_entries
)
{
@@ -256,7 +229,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -267,11 +240,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterBandolier> All()
static std::vector<CharacterBandolier> All(Database& db)
{
std::vector<CharacterBandolier> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -296,11 +269,11 @@ public:
return all_entries;
}
static std::vector<CharacterBandolier> GetWhere(std::string where_filter)
static std::vector<CharacterBandolier> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterBandolier> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -326,9 +299,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -339,9 +312,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_CHARACTER_BIND_REPOSITORY_H
@@ -69,21 +52,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("character_bind");
@@ -103,7 +71,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -138,10 +106,11 @@ public:
}
static CharacterBind FindOne(
Database& db,
int character_bind_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -169,10 +138,11 @@ public:
}
static int DeleteOne(
Database& db,
int character_bind_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -185,6 +155,7 @@ public:
}
static int UpdateOne(
Database& db,
CharacterBind character_bind_entry
)
{
@@ -200,7 +171,7 @@ public:
update_values.push_back(columns[6] + " = " + std::to_string(character_bind_entry.z));
update_values.push_back(columns[7] + " = " + std::to_string(character_bind_entry.heading));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -214,11 +185,13 @@ public:
}
static CharacterBind InsertOne(
Database& db,
CharacterBind character_bind_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_bind_entry.id));
insert_values.push_back(std::to_string(character_bind_entry.slot));
insert_values.push_back(std::to_string(character_bind_entry.zone_id));
insert_values.push_back(std::to_string(character_bind_entry.instance_id));
@@ -227,7 +200,7 @@ public:
insert_values.push_back(std::to_string(character_bind_entry.z));
insert_values.push_back(std::to_string(character_bind_entry.heading));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -246,6 +219,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharacterBind> character_bind_entries
)
{
@@ -254,6 +228,7 @@ public:
for (auto &character_bind_entry: character_bind_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_bind_entry.id));
insert_values.push_back(std::to_string(character_bind_entry.slot));
insert_values.push_back(std::to_string(character_bind_entry.zone_id));
insert_values.push_back(std::to_string(character_bind_entry.instance_id));
@@ -267,7 +242,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -278,11 +253,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterBind> All()
static std::vector<CharacterBind> All(Database& db)
{
std::vector<CharacterBind> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -309,11 +284,11 @@ public:
return all_entries;
}
static std::vector<CharacterBind> GetWhere(std::string where_filter)
static std::vector<CharacterBind> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterBind> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -341,9 +316,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -354,9 +329,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_CHARACTER_BUFFS_REPOSITORY_H
@@ -87,21 +70,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("character_buffs");
@@ -121,7 +89,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -165,10 +133,11 @@ public:
}
static CharacterBuffs FindOne(
Database& db,
int character_buffs_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -205,10 +174,11 @@ public:
}
static int DeleteOne(
Database& db,
int character_buffs_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -221,6 +191,7 @@ public:
}
static int UpdateOne(
Database& db,
CharacterBuffs character_buffs_entry
)
{
@@ -246,7 +217,7 @@ public:
update_values.push_back(columns[15] + " = " + std::to_string(character_buffs_entry.ExtraDIChance));
update_values.push_back(columns[16] + " = " + std::to_string(character_buffs_entry.instrument_mod));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -260,6 +231,7 @@ public:
}
static CharacterBuffs InsertOne(
Database& db,
CharacterBuffs character_buffs_entry
)
{
@@ -283,7 +255,7 @@ public:
insert_values.push_back(std::to_string(character_buffs_entry.ExtraDIChance));
insert_values.push_back(std::to_string(character_buffs_entry.instrument_mod));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -302,6 +274,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharacterBuffs> character_buffs_entries
)
{
@@ -333,7 +306,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -344,11 +317,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterBuffs> All()
static std::vector<CharacterBuffs> All(Database& db)
{
std::vector<CharacterBuffs> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -384,11 +357,11 @@ public:
return all_entries;
}
static std::vector<CharacterBuffs> GetWhere(std::string where_filter)
static std::vector<CharacterBuffs> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterBuffs> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -425,9 +398,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -438,9 +411,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_CHARACTER_CORPSE_ITEMS_REPOSITORY_H
@@ -75,21 +58,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("character_corpse_items");
@@ -109,7 +77,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -147,10 +115,11 @@ public:
}
static CharacterCorpseItems FindOne(
Database& db,
int character_corpse_items_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -181,10 +150,11 @@ public:
}
static int DeleteOne(
Database& db,
int character_corpse_items_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -197,6 +167,7 @@ public:
}
static int UpdateOne(
Database& db,
CharacterCorpseItems character_corpse_items_entry
)
{
@@ -216,7 +187,7 @@ public:
update_values.push_back(columns[9] + " = " + std::to_string(character_corpse_items_entry.aug_6));
update_values.push_back(columns[10] + " = " + std::to_string(character_corpse_items_entry.attuned));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -230,6 +201,7 @@ public:
}
static CharacterCorpseItems InsertOne(
Database& db,
CharacterCorpseItems character_corpse_items_entry
)
{
@@ -247,7 +219,7 @@ public:
insert_values.push_back(std::to_string(character_corpse_items_entry.aug_6));
insert_values.push_back(std::to_string(character_corpse_items_entry.attuned));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -266,6 +238,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharacterCorpseItems> character_corpse_items_entries
)
{
@@ -291,7 +264,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -302,11 +275,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterCorpseItems> All()
static std::vector<CharacterCorpseItems> All(Database& db)
{
std::vector<CharacterCorpseItems> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -336,11 +309,11 @@ public:
return all_entries;
}
static std::vector<CharacterCorpseItems> GetWhere(std::string where_filter)
static std::vector<CharacterCorpseItems> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterCorpseItems> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -371,9 +344,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -384,9 +357,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_CHARACTER_CORPSES_REPOSITORY_H
@@ -147,21 +130,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("character_corpses");
@@ -181,7 +149,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -255,10 +223,11 @@ public:
}
static CharacterCorpses FindOne(
Database& db,
int character_corpses_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -325,10 +294,11 @@ public:
}
static int DeleteOne(
Database& db,
int character_corpses_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -341,6 +311,7 @@ public:
}
static int UpdateOne(
Database& db,
CharacterCorpses character_corpses_entry
)
{
@@ -395,7 +366,7 @@ public:
update_values.push_back(columns[45] + " = " + std::to_string(character_corpses_entry.wc_8));
update_values.push_back(columns[46] + " = " + std::to_string(character_corpses_entry.wc_9));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -409,11 +380,13 @@ public:
}
static CharacterCorpses InsertOne(
Database& db,
CharacterCorpses character_corpses_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_corpses_entry.id));
insert_values.push_back(std::to_string(character_corpses_entry.charid));
insert_values.push_back("'" + EscapeString(character_corpses_entry.charname) + "'");
insert_values.push_back(std::to_string(character_corpses_entry.zone_id));
@@ -461,7 +434,7 @@ public:
insert_values.push_back(std::to_string(character_corpses_entry.wc_8));
insert_values.push_back(std::to_string(character_corpses_entry.wc_9));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -480,6 +453,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharacterCorpses> character_corpses_entries
)
{
@@ -488,6 +462,7 @@ public:
for (auto &character_corpses_entry: character_corpses_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_corpses_entry.id));
insert_values.push_back(std::to_string(character_corpses_entry.charid));
insert_values.push_back("'" + EscapeString(character_corpses_entry.charname) + "'");
insert_values.push_back(std::to_string(character_corpses_entry.zone_id));
@@ -540,7 +515,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -551,11 +526,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterCorpses> All()
static std::vector<CharacterCorpses> All(Database& db)
{
std::vector<CharacterCorpses> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -621,11 +596,11 @@ public:
return all_entries;
}
static std::vector<CharacterCorpses> GetWhere(std::string where_filter)
static std::vector<CharacterCorpses> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterCorpses> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -692,9 +667,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -705,9 +680,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_CHARACTER_CURRENCY_REPOSITORY_H
@@ -87,21 +70,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("character_currency");
@@ -121,7 +89,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -165,10 +133,11 @@ public:
}
static CharacterCurrency FindOne(
Database& db,
int character_currency_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -205,10 +174,11 @@ public:
}
static int DeleteOne(
Database& db,
int character_currency_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -221,6 +191,7 @@ public:
}
static int UpdateOne(
Database& db,
CharacterCurrency character_currency_entry
)
{
@@ -246,7 +217,7 @@ public:
update_values.push_back(columns[15] + " = " + std::to_string(character_currency_entry.ebon_crystals));
update_values.push_back(columns[16] + " = " + std::to_string(character_currency_entry.career_ebon_crystals));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -260,6 +231,7 @@ public:
}
static CharacterCurrency InsertOne(
Database& db,
CharacterCurrency character_currency_entry
)
{
@@ -283,7 +255,7 @@ public:
insert_values.push_back(std::to_string(character_currency_entry.ebon_crystals));
insert_values.push_back(std::to_string(character_currency_entry.career_ebon_crystals));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -302,6 +274,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharacterCurrency> character_currency_entries
)
{
@@ -333,7 +306,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -344,11 +317,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterCurrency> All()
static std::vector<CharacterCurrency> All(Database& db)
{
std::vector<CharacterCurrency> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -384,11 +357,11 @@ public:
return all_entries;
}
static std::vector<CharacterCurrency> GetWhere(std::string where_filter)
static std::vector<CharacterCurrency> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterCurrency> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -425,9 +398,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -438,9 +411,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_CHARACTER_DATA_REPOSITORY_H
@@ -257,21 +240,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("character_data");
@@ -291,7 +259,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -420,10 +388,11 @@ public:
}
static CharacterData FindOne(
Database& db,
int character_data_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -545,10 +514,11 @@ public:
}
static int DeleteOne(
Database& db,
int character_data_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -561,6 +531,7 @@ public:
}
static int UpdateOne(
Database& db,
CharacterData character_data_entry
)
{
@@ -670,7 +641,7 @@ public:
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) + "'");
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -684,11 +655,13 @@ public:
}
static CharacterData InsertOne(
Database& db,
CharacterData character_data_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_data_entry.id));
insert_values.push_back(std::to_string(character_data_entry.account_id));
insert_values.push_back("'" + EscapeString(character_data_entry.name) + "'");
insert_values.push_back("'" + EscapeString(character_data_entry.last_name) + "'");
@@ -791,7 +764,7 @@ public:
insert_values.push_back(std::to_string(character_data_entry.e_last_invsnapshot));
insert_values.push_back("'" + EscapeString(character_data_entry.deleted_at) + "'");
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -810,6 +783,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharacterData> character_data_entries
)
{
@@ -818,6 +792,7 @@ public:
for (auto &character_data_entry: character_data_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_data_entry.id));
insert_values.push_back(std::to_string(character_data_entry.account_id));
insert_values.push_back("'" + EscapeString(character_data_entry.name) + "'");
insert_values.push_back("'" + EscapeString(character_data_entry.last_name) + "'");
@@ -925,7 +900,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -936,11 +911,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterData> All()
static std::vector<CharacterData> All(Database& db)
{
std::vector<CharacterData> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -1061,11 +1036,11 @@ public:
return all_entries;
}
static std::vector<CharacterData> GetWhere(std::string where_filter)
static std::vector<CharacterData> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterData> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -1187,9 +1162,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -1200,9 +1175,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_CHARACTER_DISCIPLINES_REPOSITORY_H
@@ -59,21 +42,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("character_disciplines");
@@ -93,7 +61,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -123,10 +91,11 @@ public:
}
static CharacterDisciplines FindOne(
Database& db,
int character_disciplines_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -149,10 +118,11 @@ public:
}
static int DeleteOne(
Database& db,
int character_disciplines_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -165,6 +135,7 @@ public:
}
static int UpdateOne(
Database& db,
CharacterDisciplines character_disciplines_entry
)
{
@@ -176,7 +147,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_disciplines_entry.slot_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_disciplines_entry.disc_id));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -190,6 +161,7 @@ public:
}
static CharacterDisciplines InsertOne(
Database& db,
CharacterDisciplines character_disciplines_entry
)
{
@@ -199,7 +171,7 @@ public:
insert_values.push_back(std::to_string(character_disciplines_entry.slot_id));
insert_values.push_back(std::to_string(character_disciplines_entry.disc_id));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -218,6 +190,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharacterDisciplines> character_disciplines_entries
)
{
@@ -235,7 +208,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -246,11 +219,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterDisciplines> All()
static std::vector<CharacterDisciplines> All(Database& db)
{
std::vector<CharacterDisciplines> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -272,11 +245,11 @@ public:
return all_entries;
}
static std::vector<CharacterDisciplines> GetWhere(std::string where_filter)
static std::vector<CharacterDisciplines> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterDisciplines> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -299,9 +272,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -312,9 +285,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -0,0 +1,337 @@
/**
* 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_EXPEDITION_LOCKOUTS_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_EXPEDITION_LOCKOUTS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterExpeditionLockoutsRepository {
public:
struct CharacterExpeditionLockouts {
int id;
int character_id;
std::string expedition_name;
std::string event_name;
std::string expire_time;
int duration;
std::string from_expedition_uuid;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"character_id",
"expedition_name",
"event_name",
"expire_time",
"duration",
"from_expedition_uuid",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("character_expedition_lockouts");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static CharacterExpeditionLockouts NewEntity()
{
CharacterExpeditionLockouts entry{};
entry.id = 0;
entry.character_id = 0;
entry.expedition_name = "";
entry.event_name = "";
entry.expire_time = "";
entry.duration = 0;
entry.from_expedition_uuid = "";
return entry;
}
static CharacterExpeditionLockouts GetCharacterExpeditionLockoutsEntry(
const std::vector<CharacterExpeditionLockouts> &character_expedition_lockoutss,
int character_expedition_lockouts_id
)
{
for (auto &character_expedition_lockouts : character_expedition_lockoutss) {
if (character_expedition_lockouts.id == character_expedition_lockouts_id) {
return character_expedition_lockouts;
}
}
return NewEntity();
}
static CharacterExpeditionLockouts FindOne(
Database& db,
int character_expedition_lockouts_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_expedition_lockouts_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterExpeditionLockouts entry{};
entry.id = atoi(row[0]);
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.duration = atoi(row[5]);
entry.from_expedition_uuid = row[6] ? row[6] : "";
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int character_expedition_lockouts_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_expedition_lockouts_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
CharacterExpeditionLockouts character_expedition_lockouts_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
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[5] + " = " + std::to_string(character_expedition_lockouts_entry.duration));
update_values.push_back(columns[6] + " = '" + EscapeString(character_expedition_lockouts_entry.from_expedition_uuid) + "'");
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_expedition_lockouts_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterExpeditionLockouts InsertOne(
Database& db,
CharacterExpeditionLockouts character_expedition_lockouts_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_expedition_lockouts_entry.id));
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(std::to_string(character_expedition_lockouts_entry.duration));
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.from_expedition_uuid) + "'");
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_expedition_lockouts_entry.id = results.LastInsertedID();
return character_expedition_lockouts_entry;
}
character_expedition_lockouts_entry = NewEntity();
return character_expedition_lockouts_entry;
}
static int InsertMany(
Database& db,
std::vector<CharacterExpeditionLockouts> character_expedition_lockouts_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_expedition_lockouts_entry: character_expedition_lockouts_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_expedition_lockouts_entry.id));
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(std::to_string(character_expedition_lockouts_entry.duration));
insert_values.push_back("'" + EscapeString(character_expedition_lockouts_entry.from_expedition_uuid) + "'");
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<CharacterExpeditionLockouts> All(Database& db)
{
std::vector<CharacterExpeditionLockouts> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterExpeditionLockouts entry{};
entry.id = atoi(row[0]);
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.duration = atoi(row[5]);
entry.from_expedition_uuid = row[6] ? row[6] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterExpeditionLockouts> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterExpeditionLockouts> 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) {
CharacterExpeditionLockouts entry{};
entry.id = atoi(row[0]);
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.duration = atoi(row[5]);
entry.from_expedition_uuid = row[6] ? row[6] : "";
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_EXPEDITION_LOCKOUTS_REPOSITORY_H
@@ -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_CHARACTER_INSPECT_MESSAGES_REPOSITORY_H
@@ -57,21 +40,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("character_inspect_messages");
@@ -91,7 +59,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -120,10 +88,11 @@ public:
}
static CharacterInspectMessages FindOne(
Database& db,
int character_inspect_messages_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -145,10 +114,11 @@ public:
}
static int DeleteOne(
Database& db,
int character_inspect_messages_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -161,6 +131,7 @@ public:
}
static int UpdateOne(
Database& db,
CharacterInspectMessages character_inspect_messages_entry
)
{
@@ -171,7 +142,7 @@ public:
update_values.push_back(columns[0] + " = " + std::to_string(character_inspect_messages_entry.id));
update_values.push_back(columns[1] + " = '" + EscapeString(character_inspect_messages_entry.inspect_message) + "'");
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -185,6 +156,7 @@ public:
}
static CharacterInspectMessages InsertOne(
Database& db,
CharacterInspectMessages character_inspect_messages_entry
)
{
@@ -193,7 +165,7 @@ public:
insert_values.push_back(std::to_string(character_inspect_messages_entry.id));
insert_values.push_back("'" + EscapeString(character_inspect_messages_entry.inspect_message) + "'");
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -212,6 +184,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharacterInspectMessages> character_inspect_messages_entries
)
{
@@ -228,7 +201,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -239,11 +212,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterInspectMessages> All()
static std::vector<CharacterInspectMessages> All(Database& db)
{
std::vector<CharacterInspectMessages> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -264,11 +237,11 @@ public:
return all_entries;
}
static std::vector<CharacterInspectMessages> GetWhere(std::string where_filter)
static std::vector<CharacterInspectMessages> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterInspectMessages> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -290,9 +263,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -303,9 +276,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_CHARACTER_ITEM_RECAST_REPOSITORY_H
@@ -59,21 +42,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("character_item_recast");
@@ -93,7 +61,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -123,10 +91,11 @@ public:
}
static CharacterItemRecast FindOne(
Database& db,
int character_item_recast_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -149,10 +118,11 @@ public:
}
static int DeleteOne(
Database& db,
int character_item_recast_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -165,6 +135,7 @@ public:
}
static int UpdateOne(
Database& db,
CharacterItemRecast character_item_recast_entry
)
{
@@ -176,7 +147,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_item_recast_entry.recast_type));
update_values.push_back(columns[2] + " = " + std::to_string(character_item_recast_entry.timestamp));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -190,6 +161,7 @@ public:
}
static CharacterItemRecast InsertOne(
Database& db,
CharacterItemRecast character_item_recast_entry
)
{
@@ -199,7 +171,7 @@ public:
insert_values.push_back(std::to_string(character_item_recast_entry.recast_type));
insert_values.push_back(std::to_string(character_item_recast_entry.timestamp));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -218,6 +190,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharacterItemRecast> character_item_recast_entries
)
{
@@ -235,7 +208,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -246,11 +219,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterItemRecast> All()
static std::vector<CharacterItemRecast> All(Database& db)
{
std::vector<CharacterItemRecast> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -272,11 +245,11 @@ public:
return all_entries;
}
static std::vector<CharacterItemRecast> GetWhere(std::string where_filter)
static std::vector<CharacterItemRecast> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterItemRecast> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -299,9 +272,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -312,9 +285,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_CHARACTER_LANGUAGES_REPOSITORY_H
@@ -59,21 +42,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("character_languages");
@@ -93,7 +61,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -123,10 +91,11 @@ public:
}
static CharacterLanguages FindOne(
Database& db,
int character_languages_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -149,10 +118,11 @@ public:
}
static int DeleteOne(
Database& db,
int character_languages_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -165,6 +135,7 @@ public:
}
static int UpdateOne(
Database& db,
CharacterLanguages character_languages_entry
)
{
@@ -175,7 +146,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_languages_entry.lang_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_languages_entry.value));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -189,15 +160,17 @@ public:
}
static CharacterLanguages InsertOne(
Database& db,
CharacterLanguages character_languages_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_languages_entry.id));
insert_values.push_back(std::to_string(character_languages_entry.lang_id));
insert_values.push_back(std::to_string(character_languages_entry.value));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -216,6 +189,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharacterLanguages> character_languages_entries
)
{
@@ -224,6 +198,7 @@ public:
for (auto &character_languages_entry: character_languages_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_languages_entry.id));
insert_values.push_back(std::to_string(character_languages_entry.lang_id));
insert_values.push_back(std::to_string(character_languages_entry.value));
@@ -232,7 +207,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -243,11 +218,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterLanguages> All()
static std::vector<CharacterLanguages> All(Database& db)
{
std::vector<CharacterLanguages> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -269,11 +244,11 @@ public:
return all_entries;
}
static std::vector<CharacterLanguages> GetWhere(std::string where_filter)
static std::vector<CharacterLanguages> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterLanguages> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -296,9 +271,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -309,9 +284,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_CHARACTER_LEADERSHIP_ABILITIES_REPOSITORY_H
@@ -59,21 +42,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("character_leadership_abilities");
@@ -93,7 +61,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -123,10 +91,11 @@ public:
}
static CharacterLeadershipAbilities FindOne(
Database& db,
int character_leadership_abilities_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -149,10 +118,11 @@ public:
}
static int DeleteOne(
Database& db,
int character_leadership_abilities_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -165,6 +135,7 @@ public:
}
static int UpdateOne(
Database& db,
CharacterLeadershipAbilities character_leadership_abilities_entry
)
{
@@ -176,7 +147,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_leadership_abilities_entry.slot));
update_values.push_back(columns[2] + " = " + std::to_string(character_leadership_abilities_entry.rank));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -190,6 +161,7 @@ public:
}
static CharacterLeadershipAbilities InsertOne(
Database& db,
CharacterLeadershipAbilities character_leadership_abilities_entry
)
{
@@ -199,7 +171,7 @@ public:
insert_values.push_back(std::to_string(character_leadership_abilities_entry.slot));
insert_values.push_back(std::to_string(character_leadership_abilities_entry.rank));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -218,6 +190,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharacterLeadershipAbilities> character_leadership_abilities_entries
)
{
@@ -235,7 +208,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -246,11 +219,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterLeadershipAbilities> All()
static std::vector<CharacterLeadershipAbilities> All(Database& db)
{
std::vector<CharacterLeadershipAbilities> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -272,11 +245,11 @@ public:
return all_entries;
}
static std::vector<CharacterLeadershipAbilities> GetWhere(std::string where_filter)
static std::vector<CharacterLeadershipAbilities> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterLeadershipAbilities> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -299,9 +272,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -312,9 +285,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_CHARACTER_MATERIAL_REPOSITORY_H
@@ -67,21 +50,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("character_material");
@@ -101,7 +69,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -135,10 +103,11 @@ public:
}
static CharacterMaterial FindOne(
Database& db,
int character_material_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -165,10 +134,11 @@ public:
}
static int DeleteOne(
Database& db,
int character_material_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -181,6 +151,7 @@ public:
}
static int UpdateOne(
Database& db,
CharacterMaterial character_material_entry
)
{
@@ -195,7 +166,7 @@ public:
update_values.push_back(columns[5] + " = " + std::to_string(character_material_entry.use_tint));
update_values.push_back(columns[6] + " = " + std::to_string(character_material_entry.color));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -209,11 +180,13 @@ public:
}
static CharacterMaterial InsertOne(
Database& db,
CharacterMaterial character_material_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_material_entry.id));
insert_values.push_back(std::to_string(character_material_entry.slot));
insert_values.push_back(std::to_string(character_material_entry.blue));
insert_values.push_back(std::to_string(character_material_entry.green));
@@ -221,7 +194,7 @@ public:
insert_values.push_back(std::to_string(character_material_entry.use_tint));
insert_values.push_back(std::to_string(character_material_entry.color));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -240,6 +213,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharacterMaterial> character_material_entries
)
{
@@ -248,6 +222,7 @@ public:
for (auto &character_material_entry: character_material_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_material_entry.id));
insert_values.push_back(std::to_string(character_material_entry.slot));
insert_values.push_back(std::to_string(character_material_entry.blue));
insert_values.push_back(std::to_string(character_material_entry.green));
@@ -260,7 +235,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -271,11 +246,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterMaterial> All()
static std::vector<CharacterMaterial> All(Database& db)
{
std::vector<CharacterMaterial> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -301,11 +276,11 @@ public:
return all_entries;
}
static std::vector<CharacterMaterial> GetWhere(std::string where_filter)
static std::vector<CharacterMaterial> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterMaterial> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -332,9 +307,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -345,9 +320,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_CHARACTER_MEMMED_SPELLS_REPOSITORY_H
@@ -59,21 +42,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("character_memmed_spells");
@@ -93,7 +61,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -123,10 +91,11 @@ public:
}
static CharacterMemmedSpells FindOne(
Database& db,
int character_memmed_spells_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -149,10 +118,11 @@ public:
}
static int DeleteOne(
Database& db,
int character_memmed_spells_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -165,6 +135,7 @@ public:
}
static int UpdateOne(
Database& db,
CharacterMemmedSpells character_memmed_spells_entry
)
{
@@ -176,7 +147,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_memmed_spells_entry.slot_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_memmed_spells_entry.spell_id));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -190,6 +161,7 @@ public:
}
static CharacterMemmedSpells InsertOne(
Database& db,
CharacterMemmedSpells character_memmed_spells_entry
)
{
@@ -199,7 +171,7 @@ public:
insert_values.push_back(std::to_string(character_memmed_spells_entry.slot_id));
insert_values.push_back(std::to_string(character_memmed_spells_entry.spell_id));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -218,6 +190,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharacterMemmedSpells> character_memmed_spells_entries
)
{
@@ -235,7 +208,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -246,11 +219,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterMemmedSpells> All()
static std::vector<CharacterMemmedSpells> All(Database& db)
{
std::vector<CharacterMemmedSpells> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -272,11 +245,11 @@ public:
return all_entries;
}
static std::vector<CharacterMemmedSpells> GetWhere(std::string where_filter)
static std::vector<CharacterMemmedSpells> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterMemmedSpells> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -299,9 +272,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -312,9 +285,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_CHARACTER_PET_BUFFS_REPOSITORY_H
@@ -75,21 +58,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("character_pet_buffs");
@@ -109,7 +77,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -147,10 +115,11 @@ public:
}
static CharacterPetBuffs FindOne(
Database& db,
int character_pet_buffs_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -181,10 +150,11 @@ public:
}
static int DeleteOne(
Database& db,
int character_pet_buffs_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -197,6 +167,7 @@ public:
}
static int UpdateOne(
Database& db,
CharacterPetBuffs character_pet_buffs_entry
)
{
@@ -216,7 +187,7 @@ public:
update_values.push_back(columns[9] + " = " + std::to_string(character_pet_buffs_entry.rune));
update_values.push_back(columns[10] + " = " + std::to_string(character_pet_buffs_entry.instrument_mod));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -230,6 +201,7 @@ public:
}
static CharacterPetBuffs InsertOne(
Database& db,
CharacterPetBuffs character_pet_buffs_entry
)
{
@@ -247,7 +219,7 @@ public:
insert_values.push_back(std::to_string(character_pet_buffs_entry.rune));
insert_values.push_back(std::to_string(character_pet_buffs_entry.instrument_mod));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -266,6 +238,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharacterPetBuffs> character_pet_buffs_entries
)
{
@@ -291,7 +264,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -302,11 +275,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterPetBuffs> All()
static std::vector<CharacterPetBuffs> All(Database& db)
{
std::vector<CharacterPetBuffs> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -336,11 +309,11 @@ public:
return all_entries;
}
static std::vector<CharacterPetBuffs> GetWhere(std::string where_filter)
static std::vector<CharacterPetBuffs> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterPetBuffs> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -371,9 +344,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -384,9 +357,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_CHARACTER_PET_INFO_REPOSITORY_H
@@ -43,6 +26,7 @@ public:
int hp;
int mana;
float size;
int taunting;
};
static std::string PrimaryKey()
@@ -61,6 +45,7 @@ public:
"hp",
"mana",
"size",
"taunting",
};
}
@@ -69,21 +54,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("character_pet_info");
@@ -103,7 +73,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -119,6 +89,7 @@ public:
entry.hp = 0;
entry.mana = 0;
entry.size = 0;
entry.taunting = 1;
return entry;
}
@@ -138,10 +109,11 @@ public:
}
static CharacterPetInfo FindOne(
Database& db,
int character_pet_info_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -161,6 +133,7 @@ public:
entry.hp = atoi(row[5]);
entry.mana = atoi(row[6]);
entry.size = static_cast<float>(atof(row[7]));
entry.taunting = atoi(row[8]);
return entry;
}
@@ -169,10 +142,11 @@ public:
}
static int DeleteOne(
Database& db,
int character_pet_info_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -185,6 +159,7 @@ public:
}
static int UpdateOne(
Database& db,
CharacterPetInfo character_pet_info_entry
)
{
@@ -200,8 +175,9 @@ public:
update_values.push_back(columns[5] + " = " + std::to_string(character_pet_info_entry.hp));
update_values.push_back(columns[6] + " = " + std::to_string(character_pet_info_entry.mana));
update_values.push_back(columns[7] + " = " + std::to_string(character_pet_info_entry.size));
update_values.push_back(columns[8] + " = " + std::to_string(character_pet_info_entry.taunting));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -215,6 +191,7 @@ public:
}
static CharacterPetInfo InsertOne(
Database& db,
CharacterPetInfo character_pet_info_entry
)
{
@@ -228,8 +205,9 @@ public:
insert_values.push_back(std::to_string(character_pet_info_entry.hp));
insert_values.push_back(std::to_string(character_pet_info_entry.mana));
insert_values.push_back(std::to_string(character_pet_info_entry.size));
insert_values.push_back(std::to_string(character_pet_info_entry.taunting));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -248,6 +226,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharacterPetInfo> character_pet_info_entries
)
{
@@ -264,13 +243,14 @@ public:
insert_values.push_back(std::to_string(character_pet_info_entry.hp));
insert_values.push_back(std::to_string(character_pet_info_entry.mana));
insert_values.push_back(std::to_string(character_pet_info_entry.size));
insert_values.push_back(std::to_string(character_pet_info_entry.taunting));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -281,11 +261,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterPetInfo> All()
static std::vector<CharacterPetInfo> All(Database& db)
{
std::vector<CharacterPetInfo> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -305,6 +285,7 @@ public:
entry.hp = atoi(row[5]);
entry.mana = atoi(row[6]);
entry.size = static_cast<float>(atof(row[7]));
entry.taunting = atoi(row[8]);
all_entries.push_back(entry);
}
@@ -312,11 +293,11 @@ public:
return all_entries;
}
static std::vector<CharacterPetInfo> GetWhere(std::string where_filter)
static std::vector<CharacterPetInfo> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterPetInfo> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -337,6 +318,7 @@ public:
entry.hp = atoi(row[5]);
entry.mana = atoi(row[6]);
entry.size = static_cast<float>(atof(row[7]));
entry.taunting = atoi(row[8]);
all_entries.push_back(entry);
}
@@ -344,9 +326,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -357,9 +339,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_CHARACTER_PET_INVENTORY_REPOSITORY_H
@@ -61,21 +44,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("character_pet_inventory");
@@ -95,7 +63,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -126,10 +94,11 @@ public:
}
static CharacterPetInventory FindOne(
Database& db,
int character_pet_inventory_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -153,10 +122,11 @@ public:
}
static int DeleteOne(
Database& db,
int character_pet_inventory_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -169,6 +139,7 @@ public:
}
static int UpdateOne(
Database& db,
CharacterPetInventory character_pet_inventory_entry
)
{
@@ -181,7 +152,7 @@ public:
update_values.push_back(columns[2] + " = " + std::to_string(character_pet_inventory_entry.slot));
update_values.push_back(columns[3] + " = " + std::to_string(character_pet_inventory_entry.item_id));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -195,6 +166,7 @@ public:
}
static CharacterPetInventory InsertOne(
Database& db,
CharacterPetInventory character_pet_inventory_entry
)
{
@@ -205,7 +177,7 @@ public:
insert_values.push_back(std::to_string(character_pet_inventory_entry.slot));
insert_values.push_back(std::to_string(character_pet_inventory_entry.item_id));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -224,6 +196,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharacterPetInventory> character_pet_inventory_entries
)
{
@@ -242,7 +215,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -253,11 +226,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterPetInventory> All()
static std::vector<CharacterPetInventory> All(Database& db)
{
std::vector<CharacterPetInventory> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -280,11 +253,11 @@ public:
return all_entries;
}
static std::vector<CharacterPetInventory> GetWhere(std::string where_filter)
static std::vector<CharacterPetInventory> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterPetInventory> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -308,9 +281,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -321,9 +294,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_CHARACTER_POTIONBELT_REPOSITORY_H
@@ -61,21 +44,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("character_potionbelt");
@@ -95,7 +63,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -126,10 +94,11 @@ public:
}
static CharacterPotionbelt FindOne(
Database& db,
int character_potionbelt_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -153,10 +122,11 @@ public:
}
static int DeleteOne(
Database& db,
int character_potionbelt_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -169,6 +139,7 @@ public:
}
static int UpdateOne(
Database& db,
CharacterPotionbelt character_potionbelt_entry
)
{
@@ -181,7 +152,7 @@ public:
update_values.push_back(columns[2] + " = " + std::to_string(character_potionbelt_entry.item_id));
update_values.push_back(columns[3] + " = " + std::to_string(character_potionbelt_entry.icon));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -195,6 +166,7 @@ public:
}
static CharacterPotionbelt InsertOne(
Database& db,
CharacterPotionbelt character_potionbelt_entry
)
{
@@ -205,7 +177,7 @@ public:
insert_values.push_back(std::to_string(character_potionbelt_entry.item_id));
insert_values.push_back(std::to_string(character_potionbelt_entry.icon));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -224,6 +196,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharacterPotionbelt> character_potionbelt_entries
)
{
@@ -242,7 +215,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -253,11 +226,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterPotionbelt> All()
static std::vector<CharacterPotionbelt> All(Database& db)
{
std::vector<CharacterPotionbelt> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -280,11 +253,11 @@ public:
return all_entries;
}
static std::vector<CharacterPotionbelt> GetWhere(std::string where_filter)
static std::vector<CharacterPotionbelt> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterPotionbelt> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -308,9 +281,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -321,9 +294,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
@@ -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_CHARACTER_SKILLS_REPOSITORY_H
@@ -59,21 +42,6 @@ public:
return std::string(implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("character_skills");
@@ -93,7 +61,7 @@ public:
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
ColumnsRaw()
);
}
@@ -123,10 +91,11 @@ public:
}
static CharacterSkills FindOne(
Database& db,
int character_skills_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
@@ -149,10 +118,11 @@ public:
}
static int DeleteOne(
Database& db,
int character_skills_id
)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
@@ -165,6 +135,7 @@ public:
}
static int UpdateOne(
Database& db,
CharacterSkills character_skills_entry
)
{
@@ -175,7 +146,7 @@ public:
update_values.push_back(columns[1] + " = " + std::to_string(character_skills_entry.skill_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_skills_entry.value));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
@@ -189,15 +160,17 @@ public:
}
static CharacterSkills InsertOne(
Database& db,
CharacterSkills character_skills_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_skills_entry.id));
insert_values.push_back(std::to_string(character_skills_entry.skill_id));
insert_values.push_back(std::to_string(character_skills_entry.value));
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
@@ -216,6 +189,7 @@ public:
}
static int InsertMany(
Database& db,
std::vector<CharacterSkills> character_skills_entries
)
{
@@ -224,6 +198,7 @@ public:
for (auto &character_skills_entry: character_skills_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_skills_entry.id));
insert_values.push_back(std::to_string(character_skills_entry.skill_id));
insert_values.push_back(std::to_string(character_skills_entry.value));
@@ -232,7 +207,7 @@ public:
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
@@ -243,11 +218,11 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterSkills> All()
static std::vector<CharacterSkills> All(Database& db)
{
std::vector<CharacterSkills> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
@@ -269,11 +244,11 @@ public:
return all_entries;
}
static std::vector<CharacterSkills> GetWhere(std::string where_filter)
static std::vector<CharacterSkills> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterSkills> all_entries;
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
@@ -296,9 +271,9 @@ public:
return all_entries;
}
static int DeleteWhere(std::string where_filter)
static int DeleteWhere(Database& db, std::string where_filter)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
@@ -309,9 +284,9 @@ public:
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
static int Truncate(Database& db)
{
auto results = database.QueryDatabase(
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()

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