Compare commits

..

537 Commits

Author SHA1 Message Date
KimLS 3259c98a9e Rename some lua general functions to match the rest of the conventions 2021-01-23 18:12:54 -08:00
KimLS 02518cdae1 Change rules to use cat in the actual underlying variables and by extension lua exports 2021-01-22 23:52:34 -08:00
KimLS a00ab6867c Merge branch 'filtered-msg-fix' into fix-event-lua 2021-01-21 15:59:02 -08:00
KimLS f71a6bcb60 rename lua general functions to match their api names 2021-01-21 14:48:00 -08:00
KimLS 2e409f3898 Make bot rules exist even if bots are disabled to make it easier to sync the lua rules without weird ifdefs 2021-01-21 13:57:55 -08:00
KimLS e29d7f4b27 Fix for space after events 2021-01-21 13:46:32 -08:00
KimLS 4e548a588d Update opcodes for lua 2021-01-21 13:42:19 -08:00
KimLS 5ed47b5e50 Remove unused opcode that has a terrible name 2021-01-21 13:39:33 -08:00
KimLS e1e93a9a48 Missing events 2021-01-21 13:28:06 -08:00
KimLS 9c9d195ff6 Fix for filtered msg using Mob* instead of Lua_Mob in lua interface 2021-01-21 13:23:23 -08:00
Chris Miles 0f5a7e1317 Merge pull request #1173 from EQEmu/akkadius/npc-guard-scan-fix
[Bugfix] Very edge case Guard awareness latency
2021-01-04 11:38:23 -06:00
Alex bebf95cfe3 Merge pull request #1170 from splose/ww
Add #wwcast command.
2021-01-03 19:19:56 -05:00
splose 02aa4302de Merge branch 'master' into ww 2021-01-03 18:58:00 -05:00
Chris Miles b7d002dd8b Merge pull request #1171 from KinglyKrab/client_fling
Add client->Fling() to Perl/Lua.
2021-01-03 17:20:04 -06:00
Chris Miles 480e3a89df Merge pull request #1172 from KinglyKrab/target_ring
Add GetTargetRingX(), GetTargetRingY(), and GetTargetRingZ() to Lua.
2021-01-03 17:19:02 -06:00
Chris Miles 427b4db2b3 Merge pull request #1166 from fryguy503/barter-bag-bug
[Bug] Barter was allowing the purchase of bags. Bags could contain…
2021-01-03 17:18:31 -06:00
Chris Miles 306328529e Merge pull request #1169 from splose/endurance
#endurance
2021-01-03 17:18:01 -06:00
Chris Miles 0396bada96 Merge pull request #1165 from fryguy503/instrument-autoequip
[Bug] Prevent Bards from auto equip loot when using instrument
2021-01-03 17:17:08 -06:00
Chris Miles e9be7146af Merge pull request #1164 from fryguy503/group-fixes
[Bug] Fix for Group Leader Disband Issue
2021-01-03 17:13:31 -06:00
Akkadius 53bbbbba1d Add comments around close mob system [skip ci] 2021-01-03 17:07:10 -06:00
Akkadius f5817677df Only add self to others when moving 2021-01-03 16:42:34 -06:00
Akkadius 7b9d88b70b Fix a situation where guards don't scan fast enough because they stand idle, moving mobs will add themselves to guards 2021-01-03 16:40:56 -06:00
Matthew Silvia 4750768e0f Merge branch 'ww' of https://github.com/splose/Server into ww
# Conflicts:
#	zone/command.cpp
2021-01-03 13:20:01 -05:00
Matthew Silvia 90295d8dec change name 2021-01-03 13:18:33 -05:00
Matthew Silvia 6fe05bbf5e change name 2021-01-03 13:16:01 -05:00
Matthew Silvia a4d8d2261a change name 2021-01-03 13:09:09 -05:00
Evan Alexander King c58ba2e6a5 Add GetTargetRingX(), GetTargetRingY(), and GetTargetRingZ() to Lua. 2021-01-03 03:21:54 -05:00
Evan Alexander King 3fa236c2bb Add client->Fling() to Perl/Lua.
- $client->Fling(value, target_x, target_y, target_z, ignore_los, clipping) in Perl.
- client:Fling(value, target_x, target_y, target_z, ignore_los, clipping) in Lua.
2021-01-03 03:12:01 -05:00
Matthew Silvia e13346560e #ww 2021-01-02 23:24:28 -05:00
Matthew Silvia d6e29810f1 #endurance 2021-01-02 23:17:47 -05:00
Trust 29e693d443 Also added LogGroupDetail 2021-01-02 22:57:57 -05:00
Trust 7fbf522aa3 Added LogGroup to logging aliases. 2021-01-02 22:54:26 -05:00
Chris Miles 0456bef903 Merge pull request #1167 from hgtw/fix/instance-corpses
Move player corpses on instance shutdown
2021-01-02 21:31:28 -06:00
hg 6c8c81f3db Move player corpses on instance shutdown
Moves corpses to graveyard when an expired instance shuts down.
Zones without a graveyard move them to non-instance version instead.

Fixes player corpses being left inside instances that expire
before graveyards process or in instances without a graveyard
2021-01-02 19:42:18 -05:00
Trust 538092d59e Fix for incorrect slot definition. 2020-12-31 11:33:04 -05:00
Trust 789cfb2490 [REBASE] Barter was allowing the purchase of bags. Bags could contain anything and it would be traded. 2020-12-31 00:44:55 -05:00
Trust 83928fa4d0 [REBASE] Prevent Bards from auto equip loot when using instrument 2020-12-31 00:22:54 -05:00
Trust f854137ca0 [BUG] Fix for Group Leader Disband Issue
Added public/private class for oldleadername so we can save the previous leader name when the entity is destroyed then allow us to transfer leadership.

Adjusted DelmemberOOZ and in zone functions to include removal of the old leader when disbanding.
2020-12-31 00:16:27 -05:00
Chris Miles de5b7f472d Merge pull request #1163 from hgtw/feat/dz-expeditions
[Expedition / DZ] HGTW DZ / Expedition System
2020-12-30 21:16:22 -06:00
hg 33e5bd0b67 Assign db version to expedition schema 2020-12-30 18:47:59 -05:00
hg a312cd6e1d Don't sync character lockout uuid
Fixes regression that caused loot event apis to stop working
2020-12-30 18:47:33 -05:00
hg 8b2b2db848 Move offline players to dz safereturn
This is an experimental change which allows members to log in at the
safe return if they were offline when the expedition was deleted.
Prior to this they would log in at bind instead

Partially reverts commit 32c69d235d
Removed expedition members are no longer hard deleted from db
2020-12-30 18:47:33 -05:00
hg 4f9eaf7574 Sync character lockouts when entering dz
This removes the is_pending column from character lockouts table

Synchronizing character lockout timers with the expedition's when zoning
into the dynamic zone simplifies adding missing lockouts to new members.
This also matches live behavior that replaces any character lockout
timers from another expedition with ones from the current expedition
2020-12-30 18:47:32 -05:00
hg fc7d8a82e5 Sort #dz list output by dz id
Sort #dz expedition list by expedition id
2020-12-30 18:47:32 -05:00
hg 81e4bd6040 Reduce expedition member status packet updates
Only send update for expedition member status if it changes

Avoids unnecessary packets when members zone
2020-12-30 18:47:32 -05:00
hg 54a175b3ef Cleanup unused arg in remove lockout method 2020-12-30 18:47:32 -05:00
hg 738fd48163 Use id not name in dz makeleader world msg 2020-12-30 18:47:32 -05:00
hg e5916c5c03 Add rule to enable "In Dynamic Zone" status
Live doesn't appear to ever update with this status
2020-12-30 18:47:32 -05:00
hg 1de590137f Verify new expedition leader in world
Cleanup makeleader methods

World now checks if character is expedition member instead of zone
2020-12-30 18:47:32 -05:00
hg 311042f06d Add ExpeditionMember::IsValid method 2020-12-30 18:47:32 -05:00
hg 6acfc41778 Let world handle expedition leader changes
This should eliminate race conditions caused by zones trying to set
a leader when members in different zones quit at the same time

Zone still detects when leader goes offline to trigger a change
since it's easier than having world process expedition member status
updates and perform expedition lookups
2020-12-30 18:47:32 -05:00
hg 955cbeb826 Revert "Don't set member offline before linkdead"
This reverts commit 8d27602aa0.

This doesn't work because a linkdead leader coming back online will
toggle to offline state anyway
2020-12-30 18:47:32 -05:00
hg 6e9f920931 Add saylinks to #dz list output 2020-12-30 18:47:32 -05:00
hg 4ae9904822 Use strlen for perl hash key size 2020-12-30 18:47:32 -05:00
hg c0b8bfde03 Fix invalid return in perl expedition api
This was returning an invalid (garbage) hash reference for
empty results when filtering on expedition name
2020-12-30 18:47:32 -05:00
hg c09ada67d6 Add expedition lock message constants to perl 2020-12-30 18:47:32 -05:00
hg cc5dd4cd82 Add missing expedition perl api declaration 2020-12-30 18:47:32 -05:00
hg 8708564889 Don't send info packet when new member added
It isn't necessary to send this packet to current members when a new
expedition member is added. The member list packet changes the current
player count on the window
2020-12-30 18:47:32 -05:00
hg f506ce9d58 Reduce packet updates when expedition member added
This fixes unnecessary packets and compass updates being sent for
invited members and better matches live's packet update pattern

This also fixes duplicate updates being sent to the added member

Live only sends a MemberListName update for members added through a
swap (player count doesn't change). For members added through an
invite it sends expedition info and a full member list update

A full member list update is sent for both cases in this patch. This
is because MemberListName currently always adds members with status
"unknown". This is either due to unknown packet fields or a change
in future clients
2020-12-30 18:47:32 -05:00
hg 074b7096df Use fmt join for simple query strings 2020-12-30 18:47:32 -05:00
hg b46eca4ec6 Store expeditions with dz id not instance id
This exposes dynamic zone ids for any future changes and will make it
easier to preserve historic dz and expedition data. This also cleans up
some dynamic zone creation for expedition requests

When purging instances the expedition table is no longer updated
since dynamic zone ids are not re-used like instance ids are

Update #dz list commands to show dz id

Add GetDynamicZoneID and get_expedition_by_dz_id quest apis
2020-12-30 18:47:32 -05:00
hg 54500b0e72 Use column aliases for expedition request query 2020-12-30 18:47:31 -05:00
hg d2ad2ec078 Add comment to FormatName 2020-12-30 18:47:31 -05:00
hg b85feb5461 Rename expedition packet fields 2020-12-30 18:47:31 -05:00
hg 022f82291a Rename world expedition cache to state 2020-12-30 18:47:31 -05:00
hg 579c300cbc Rename expeditions table 2020-12-30 18:47:31 -05:00
hg 0f051b68ae Separate world expedition source files 2020-12-30 18:47:31 -05:00
hg 58b3708a47 Use named args in CreateExpedition lua api
This is a breaking api change

All expedition request parameters are now passed via a single table
containing hash keyed options to define values
2020-12-30 18:47:31 -05:00
hg b68994f25c Change all expedition tables to latin1
The lockout tables are latin1 to support older MySQL and MariaDB
versions that limit indexes
2020-12-30 18:47:31 -05:00
hg ad51de052c Cleanup expedition perl api croak messages 2020-12-30 18:47:31 -05:00
hg 77406d7322 Add AddReplayLockoutDuration api 2020-12-30 18:47:31 -05:00
hg 3ed7215a92 Rename character expedition lockouts table 2020-12-30 18:47:31 -05:00
hg 3a1eb51890 Send lockout times with client rounding offset
Add 60s to lockout times sent to clients. Lockout timers
are rounded down to the nearest minute when displayed

This replaces the lockout leeway rule with better behavior
2020-12-30 18:47:31 -05:00
hg ca113cdd85 Let world dispatch expedition expire warnings
This depends on C++14 remaining enabled for chrono literals
2020-12-30 18:47:31 -05:00
hg da5d4b9830 Send all members expedition expire warnings
All expedition members are notified not just those in dz

This will only work if the dz is running. It might make more sense to
move this to client or world processing so members are notified even if
the zone instance isn't running
2020-12-30 18:47:31 -05:00
hg 79287fc507 Require zone id to get expedition by instance id
This is a breaking api change
eq.get_expedition_by_instance_id(instance_id) is replaced with
eq.get_expedition_by_zone_instance(zone_id, instance_id)

This replaces the FindCachedExpeditionByInstanceID method of
obtaining expeditions via instance id with a new method that
requires the dz zone id as well
2020-12-30 18:47:31 -05:00
hg cd98b8bc6f Only send member updates after caching dz data
This fixes characters not receiving a compass if they're already
in the compass zone when an expedition is created from another zone
2020-12-30 18:47:31 -05:00
hg 18dd9e6637 Add #dz expedition unlock command
Add expedition name and zone to #dz expedition list

Adjust #dz list output
2020-12-30 18:47:31 -05:00
hg 6266aa86a4 Add perl expedition api 2020-12-30 18:47:31 -05:00
hg c26c6af356 Remove rule to verify expedition leader with db
This is a holdover from earlier system design and shouldn't be necessary
2020-12-30 18:47:11 -05:00
hg a3a6e55d22 Add lockout timer multiplier rule
This allows servers to adjust all new lockout durations added
during special events like live does
2020-12-30 18:47:11 -05:00
hg b965a165b1 Add api to update expedition expire time
Add SetSecondsRemaining method to set expire time on expedition
2020-12-30 18:47:11 -05:00
hg 2c2c2ac5ee Add api to get expedition's zone name 2020-12-30 18:47:11 -05:00
hg cbccd72050 Truncate members after conflict checks
This more accurately matches live for the new behavior introduced
in the September 16, 2020 patch. All members of a raid/group are
still checked for conflicts and the truncation is only allowed if
there are none.

It might make sense to add a rule for this since ignoring members
that would exceed the expedition max from the start makes it more
convenient to create expeditions. Members that wouldn't be added
anyway don't really need their conflicts checked.
2020-12-30 18:47:11 -05:00
hg 3db23e402c Add api to add lockout to all clients in zone 2020-12-30 18:47:11 -05:00
hg c45840173e Load dz from cache on client switchlist reply 2020-12-30 18:47:11 -05:00
hg 76b5803f83 Let MovePCDynamicZone filter on zone version
Add client GetDynamicZones method to provide a single method to get all
associated client dynamic zones

Refactor compass update and MovePCDynamicZone to use this method
instead of searching for client dzs separately

Add optional disable message arg to MovePCDynamicZone
2020-12-30 18:47:11 -05:00
hg b377fd183a Add api to add lockout duration
Also supports reducing lockout duration

Add Expedition::AddLockoutDuration

Add Client::AddExpeditionLockoutDuration

Some expeditions require adding to existing lockout durations
during progression. These add the specified seconds to individual
member lockout timers instead of setting a static duration based on
internal expedition lockout like UpdateLockoutDuration.
2020-12-30 18:47:11 -05:00
hg 8e52dd0579 Add expedition lock messages 2020-12-30 18:47:11 -05:00
hg b5db40cba6 Add GetZoneVersion to expedition api 2020-12-30 18:47:11 -05:00
hg ea34aa2030 Add group and raid api to check for lockout
Add Group and Raid method DoesAnyMemberHaveExpeditionLockout

This is required by some expeditions that perform a manual check for
custom dialogue (Ikkinz group expeditions)
2020-12-30 18:47:11 -05:00
hg 40717970ff Cleanup some expedition message formatting 2020-12-30 18:47:10 -05:00
hg 1d24432e47 Truncate expedition members to max on creation
This implements the new behavior from live's September 16, 2020
(test server's September 8, 2020) patch

Expeditions can be created even when the client's group or raid
exceeds the expedition's max player requirement. Members are added
until the max player count is reached and the rest are ignored.

Raid members are added ordered by their raid group number with
ungrouped members having the lowest priority

Rename expedition request method ValidateMembers to CanMembersJoin

Change some expedition messages to System color (live changes)
2020-12-30 18:47:10 -05:00
hg a597753bee Increase default early dz shutdown time
Increases default from 15 minutes to 25 minutes

This compensates for current default graveyard timer code. Otherwise
instances may shutdown before graveyards can process any corpses.

A better fix needs implemented later to deal with corpses inside
expired dynamic zone/instances. Zones without graveyards should move
corpses to the non-instance version and zones with graveyards should
somehow still be processed (maybe offloaded to world?)
2020-12-30 18:47:10 -05:00
hg 4d1abce084 Allow zone name in alt CreateExpedition api 2020-12-30 18:47:10 -05:00
hg f822798c63 Cleanup some vector emplacements in expeditions 2020-12-30 18:47:10 -05:00
hg 0c5bd9b338 Escape expedition and event names in queries
Fixes names that have apostrophes
2020-12-30 18:47:10 -05:00
hg 779fc6265e Load character lockouts without looping 2020-12-30 18:47:10 -05:00
hg d6ab87e2c4 Avoid world message on offline member invite
Expedition member status can be used to choose the message
2020-12-30 18:47:10 -05:00
hg 6e5ca19d18 Get dz safe return from cache not db
This was loading the dz from database to get safe return data every time
a client's dz removal timer triggered

Add the Zone::GetDynamicZone() method so zones that are dz instances can
find the data from the cache of any dz systems
2020-12-30 18:47:10 -05:00
hg fba078bbe9 Format name in expedition invite message
Live uses the original unformatted user input in invite messages, but
this doesn't seem necessary to emulate
2020-12-30 18:47:10 -05:00
hg ce19deb5d1 Add rule to always notify new expedition leader
On live, new expedition leaders are only notified if made leader from
the /dzmakeleader command (or from ui). This rule makes it so the new
leader is always messaged on a leader change for cases where previous
leader goes offline or quits
2020-12-30 18:47:10 -05:00
hg 1f3c5af996 Add #dz makeleader command 2020-12-30 18:47:10 -05:00
hg 9c4df6f026 Don't set member offline before linkdead
This prevents toggling to offline state before setting to and from
linkdead status. Without this change, a new expedition leader will be
chosen as soon as the current leader goes linkdead. On live an
expedition leader retains leadership while linkdead
2020-12-30 18:47:10 -05:00
hg d8b825f478 Fix linkdead expedition member offline update
This was leaving expedition members with linkdead status even after
the client was timed out by the server
2020-12-30 18:47:10 -05:00
hg ba9ce2335e Set new expedition leader on leader disconnect
Only choose an online member as new leader on leader changes

Keep leader online status updated in zone expedition caches

Currently this will also trigger a leader change if the leader goes
linkdead. On live the character retains leadership while linkdead
and a new one is only chosen once kicked offline
2020-12-30 18:47:10 -05:00
hg 15235d77f7 Fix regression deleting expedition from db
Set expedition's instance id NULL instead of deleting it from the
database when instances are deleted. Only expedition functions
should delete expeditions

This fixes a regression caused by removing foreign key constraints

The expedition_details row was being deleted and not the corresponding
expedition_members and expedition_lockouts rows. Any characters inside
the members table could no longer join expeditions
2020-12-30 18:47:10 -05:00
hg cb4a117503 Cleanup some expedition logging and formatting
Remove logging unsanitized input

Make unsigned comparison not compare < 0

Cleanup some FormatName and string usage. Some of these strings could
probably be moved instead

Remove unnecessary expedition lookup in a world message handler
2020-12-30 18:47:10 -05:00
hg d61879fd3c Add character id based expedition apis
Add static expedition methods to add or remove character lockouts

Add CreateLockout static helper to ExpeditionLockoutTimer

Refactor existing character lockout removal to allow removal of lockouts
for offline characters (was only used by #dz lockouts remove command)

Fix #dz list member count
2020-12-30 18:47:10 -05:00
hg 3e373210c5 Remove dz check in expedition invite reply
Characters can no longer be re-invited while inside a dz, these checks
aren't necessary
2020-12-30 18:47:10 -05:00
hg 5a826add92 Cleanup expedition headers and unused variables
Modify some expedition and dz logging

Remove unnecessary includes in expedition sources
2020-12-30 18:47:10 -05:00
hg 3843ed6540 Don't log expired lockouts in expedition request
Removes logging of lockouts with timer under leeway rule
2020-12-30 18:47:09 -05:00
hg 184ea679f2 Refactor client cross zone message helpers
Remove extra cross zone message server opcode and struct. Existing
function already exists for normal messages

Group CZClientMessageString struct with other CZ structs
2020-12-30 18:47:09 -05:00
hg e99528fe73 Change lockout packet variable to signed 2020-12-30 18:47:09 -05:00
hg 70161aecc4 Remove fk constraints in expedition tables
Add expedition tables to database schema lists
2020-12-30 18:47:09 -05:00
hg e8d250827d Add api to update lockout duration
Some live expeditions update a lockout's duration during progression

The current AddLockout method replaces lockout timers. This updates the
expiration of an existing lockout by modifying the original duration

Only members are updated and not the internal expedition timer by
default. This is so new members receive the original duration like live
2020-12-30 18:47:09 -05:00
hg f97cc7cdec Add expedition event loot api
Add SetLootEventByNPCTypeID and SetLootEventBySpawnID quest apis

These associate events with npcs or entities inside the dz to prevent
them from being looted by characters that didn't receive the event
lockout from the current expedition.

This fixes an exploit that allowed a player that already had a lockout
from another expedition being added to loot after the event is complete
2020-12-30 18:47:09 -05:00
hg 06d84b83de Remove member history from expeditions
Expedition uuids are now used to check if characters may re-join
2020-12-30 18:47:09 -05:00
hg da2a6205ed Use replay timer uuid to allow re-invite
Instead of allowing all previous members to bypass a replay timer
conflict, only allow if expedition uuid of the lockout matches

This fixes an exploit for expeditions that add delayed replay timers.
Members could be part of an expedition on creation and then quit to form
another expedition. They could then always be re-invited to the original
expedition even with a conflicting replay timer lockout.
2020-12-30 18:47:09 -05:00
hg fa21d835d9 Store lockouts with source expedition uuid
Add Client::GetLockoutExpeditionUUID quest api

Refactor lockout update methods to take ExpeditionLockoutTimer parameter

Fix updating expedition lockout cache for multiple AddLockout calls

Fix updating lockout duration when replacing a lockout in database

Replace lockout timer inherited flags with expedition uuid comparisons

Remove is_inherited column from expedition_lockouts table
2020-12-30 18:47:09 -05:00
hg 6a7980ec75 Assign expeditions a uuid 2020-12-30 18:47:09 -05:00
hg f23ca8055f Remove replay timer argument to CreateExpedition
Breaking change to the current API

has_replay_timer column removed from expedition_details table

This argument is unnecessary and just creates confusion. Expedition
replay timers use a hardcoded name precisely for this purpose and
those lockouts are already being checked on creation requests.
2020-12-30 18:47:09 -05:00
hg 892556e26d Fix replay timer assignment to new members
Ignore expired state of replay timers when assigning to new members

This fixes a regression from a previous change that stopped assigning
expired lockouts to new members. Only expired event timers should be
ignored for new members. Replay Timers should always be added with a
a fresh lockout
2020-12-30 18:47:09 -05:00
hg 75410e8886 Don't allow expedition re-invite inside dz
Live requires characters that quit an expedition to zone out before
being re-added. This is probably to avoid exploiting max player
requirements by constantly swapping players in and out
2020-12-30 18:47:09 -05:00
hg 4af5f79328 Remove logging of expedition query failures
This is redundant with sql error logging. Logging the operations is
enough to determine the source of any errors
2020-12-30 18:47:09 -05:00
hg ea0b37b7fc Store expedition duration and times as chrono
This simplifies comparisons and reduces conversions
2020-12-30 18:47:09 -05:00
hg 006f7bf9e9 Don't remove expedition lockouts from non-members
Clients still inside a dz after being removed from an expedition
should only ever have lockouts added
2020-12-30 18:47:09 -05:00
hg 17be2bf2f7 Clear stale pending expedition lockouts
Delete pending lockouts of members on expedition creation

Delete pending lockouts when all members removed from expedition

This fixes an edge case where members could incorrectly be assigned
pending lockouts that were never cleared from the database (from a
server crash or other situation) after entering another dz.
2020-12-30 18:47:09 -05:00
hg 6165550133 Copy instead of moving expedition request data 2020-12-30 18:47:09 -05:00
hg 59d10a9db3 Process character lockout results in db methods 2020-12-30 18:47:09 -05:00
hg f287e9318e Refactor member validation in expedition requests
Small cleanup of logic and unused variables

Rename LoadValidationData to LoadMembersForCreateRequest

Remove unnecessary early string building for members query

Remove unnecessary lockout expired check for leader messages
2020-12-30 18:47:09 -05:00
hg 402491b36b Refactor expedition member online status requests
This optimizes character status requests by only sending a single
bulk request to world for characters in all expeditions instead of
sending a separate request for each expedition on zone startup
2020-12-30 18:47:09 -05:00
hg 2c4f505309 Refactor zone expedition caching
This optimizes caching all expeditions by loading dynamic zone data and
expedition members in bulk instead of for each expedition separately.
This reduces the number of queries from 1+2n to 3 total.

Expedition members are now joined in the initial query since empty
expeditions aren't cached anyway. Optional internal lockouts for all
cached expeditions are loaded in a single bulk query afterwards.

Dynamic Zone data is also loaded as a single bulk query afterwards to
simplify processing and keep dz database logic separated. It might be
worth investigating if joining dz data in the initial expeditions load
query is worth refactoring for.
2020-12-30 18:47:08 -05:00
hg f9eafa52f9 Ignore expired lockouts on expedition invite
This fixes an edge case with client invites sometimes failing because
an expired lockout hasn't been removed from client yet

Clients no longer receive expired lockouts from expeditions when joining
2020-12-30 18:47:08 -05:00
hg 4284624096 Remove expedition includes from client header
Make quest compass a vec3 to remove include dependency

Quest compass location doesn't require a zone id since it can only be
set in the zone that it's drawn in. Drop the DynamicZoneLocation member
and forward declare to remove the dependency on header.

Move ExpeditionInvite struct to zone common header

Including expedition.h in client.h just to use the ExpeditionInvite struct
is an unnecessary header dependency that increases incremental build time.
This allows expedition classes to be forward declared in client header.
2020-12-30 18:47:08 -05:00
hg 9b82cf57e4 Add #dz lockouts remove by event name 2020-12-30 18:47:08 -05:00
hg 9164073d14 Let world shutdown dz early for empty expeditions
Since world now tracks empty expeditions it can determine when to
shutdown dynamic zone instances when the rule is enabled rather than
letting zones do it.
2020-12-30 18:47:08 -05:00
hg 148af3edfc Only delete empty expeditions when the dz is empty
Zones are no longer able to delete expeditions. World now tracks empty
expeditions in cache and only deletes them when it detects an
expedition's dynamic zone instance has no more clients inside.

This fixes an exploit where lockouts couldn't be applied to expeditions
after all members were removed because zones were deleting the expedition
immediately. Clients still inside the dz were able to complete events
before being kicked from the instance while not having an expedition.

Expeditions are no longer purged from database in the world purge
instance timer to avoid a possible race with this new system
2020-12-30 18:47:08 -05:00
hg dcbcc5a156 Implement world cache to monitor expeditions
This implements a small cache in world to track expedition states.

This fixes expired expeditions being left in zone caches unless the
expedition's dz instance was running to detect it (or unless an
expedition was deleted via a client using /kickplayers). This was also
leaving clients in a ghost expedition that no longer actually existed
2020-12-30 18:47:08 -05:00
hg 33f2336244 Only draw dynamic zone compasses in non-instances
This fixes compasses being drawn in instances that use the same zone as compass

Also adds RemoveCompass method to quest api
2020-12-30 18:47:08 -05:00
hg 3f4ea66ea1 Implement expedition locking
Disables the ability to add new members

Adds Expedition::SetLocked(bool) to quest api

Adds is_locked column to expedition_details db table
2020-12-30 18:47:08 -05:00
hg 5ddb62e275 Make adding replay timers to new members optional
Not all expeditions with a replay timer lockout add it to newly
added members automatically

This adds the Expedition::SetReplayLockoutOnMemberJoin(bool) method
to the quest api so it can be disabled
2020-12-30 18:47:08 -05:00
hg a7795eda5d Change expedition tables to latin1_swedish_ci
Fixes insertion in MySQL older than 5.7.7 and MariaDB older than 10.2.2
that limit indexes to 767 bytes. This may be a temporary fix until
future refactoring
2020-12-30 18:47:08 -05:00
hg aee3e1084c Fix missing invite failure messages 2020-12-30 18:47:08 -05:00
hg 39fad0c1a0 Remove unused ExpeditionMemberStatus Lua constants 2020-12-30 18:47:08 -05:00
hg 32cc2d66dd Use stl algorithms for expedition member searches 2020-12-30 18:47:08 -05:00
hg 780cf148fa Use built-in benchmarking for expedition caching 2020-12-30 18:47:08 -05:00
hg 8c1f556f29 Rename #dz cache to #dz expedition
Add expedition's remaining dz time to expedition list

Move #dz destroy to a #dz expedition subcommand

Add success or failure messages to destroy command
2020-12-30 18:47:08 -05:00
hg c9504452e1 Add #dzkickplayers command for pre-RoF clients
Performs "/kickplayers exp" for older clients without the command
2020-12-30 18:47:07 -05:00
hg 528b74109e Only update dz expire time if reducing
Add optional UpdateExpireTime parameter

This is currently only used when an expedition becomes empty to make
dynamic zone instances shutdown earlier. For that it should only update
if new time is less than remaining time
2020-12-30 18:47:07 -05:00
hg 89c6d1e258 Send expedition re-invite to clients that zone
Moves expedition message handling in world to Expedition method
for messages that need special handling
2020-12-30 18:47:07 -05:00
hg 50f9a49911 Check for empty expedition via database not cache
Checking the cache on member removal here isn't reliable due to race
with cross zone message

If a zone removes a member at the same time as another zone, neither zone
can know if the expedition will be empty via cache unless it processes the
world message from the other zone's member removal first.
2020-12-30 18:47:07 -05:00
hg cc0c5afd00 Add alternative CreateExpedition api
This allows expedition creation to be passed via Lua tables

This also allows for compass, safereturn, and/or zone in location data
of dynamic zones to be set on expedition creation from lua api

Usage example:
  local instance_info = {
    "anguish", 0, 21600,
    compass = { 300, 1353.15, 1712.19, 109.001 },
    safereturn = { 300, 1349.13, 1715.00, 123.81, 0 },
    zonein = { -9, -2466, -79, 0 }
  }
  local expedition_info = { "Anguish, the Fallen Palace", 6, 54, true }
  local dz = e.other:CreateExpedition(instance_info, expedition_info)
2020-12-30 18:47:07 -05:00
hg a1b5b210dd Send client lockout update in lockout methods
Add optional client update argument to client lockout methods

This is better than requiring callers to manually send the update
2020-12-30 18:47:07 -05:00
hg d92c0e330d Validate expedition invite response server side
Stores expedition invite data on client
2020-12-30 18:47:07 -05:00
hg 43963783db Add instance time remaining to #dz list output 2020-12-30 18:47:07 -05:00
hg 11181190ee Add expired lockouts leeway rule
Adds a rule for leeway with expired lockouts during creation requests

The client removes lockout timers with under 60s remaining from the
window. This allows a small leeway to compensate so players don't
request an expedition that has visually hidden lockouts.
2020-12-30 18:47:07 -05:00
hg af766dd323 Move LoadAllClientLockouts back to a client method 2020-12-30 18:47:07 -05:00
hg 158dad052c Clear client expedition info if removed inside dz
Clears client expedition info immediately if removed inside dynamic zone

Live clears expedition info from clients removed inside a dz on the same
timer used for removals, even if the client zones before it triggers.
This is problematic to mimic and not worth the effort
2020-12-30 18:47:07 -05:00
hg a9c65cd4b2 Filter out expired instances from #dz list
Add 'all' argument to #dz list to optionally show expired instances
2020-12-30 18:47:07 -05:00
hg ef77b28b3f Add #dz lockouts remove command
This allows clearing a character's lockouts

Adds client RemoveAllExpeditionLockouts methods and exposes to lua api
2020-12-30 18:47:07 -05:00
hg b116730885 Fix wrong group leader name in expedition requests
Get group leader name from Client if possible and ask database otherwise

Group::GetLeaderName() is unreliable and broken for groups formed across
zones. The correct leader name is needed here to avoid any possible
exploits with an invalid leader bypassing lockout checks.
2020-12-30 18:47:07 -05:00
hg 78eb3be127 Add option to disable expedition conflict messages
Add optional argument to CreateExpedition to disable conflict messages

Some live expeditions like anguish use a timeout to prevent excessive
leader conflict messages while still performing a creation request
2020-12-30 18:47:07 -05:00
hg 1819b7c23b Cache new expedition before sending client updates
Compass updates get data from the expedition cache so it needs to be
cached first.

Currently this doesn't affect anything because compass isn't sent to
CreateExpedition and has to be set post-creation. In the future this
will make the order of client messages more live accurate though
2020-12-30 18:47:07 -05:00
hg eccc79e4ce Let dz handle client removal timers
Remove all clients inside a dz, not just those assigned to instance
2020-12-30 18:47:07 -05:00
hg 9102bb1478 Assign lockouts to all clients inside dz
This is live like and prevents possible exploiting by dropping
expedition before a lockout. Clients will continue receiving lockouts
until they leave the zone or are kicked via timer
2020-12-30 18:47:07 -05:00
hg 8eef2ae089 Add DynamicZone class for expedition instancing
Add DynamicZone sql table schema

Add DynamicZones logging category

Modify CreateExpedition to take DynamicZone and ExpeditionRequest objects

Implement DynamicZone compass, safereturn, and zone-in coordinates.

Implement live-like DynamicZone instance kick timer for removed members

Implement updating multiple client compasses (supports existing quest compass)

fix: Send client compass update after entering zones to clear existing compass

Implement Client::MovePCDynamicZone to invoke DynamicZoneSwitchListWnd
when entering a zone where client has multiple dynamic zones assigned

Implement OP_DzChooseZoneReply handling

Add Lua api methods for expedition's associated dynamic zone

Add #dz list gm command to list current DynamicZone instances from database
2020-12-30 18:47:07 -05:00
hg f74605d339 Implement Lua quest api for expeditions 2020-12-30 18:47:06 -05:00
hg 7798504641 Add expeditions sql schema file 2020-12-30 18:47:06 -05:00
hg da067be2fa Implement initial expedition system
Add Expeditions logging category

Add handlers for all Dynamic Zone/Expedition related opcodes

Add FormatName string_util function to format character names

Add Zone::IsZone helper method

Add cross zone MessageString support with variable parameters

Add static Client method helpers for cross zone messaging

Add #dz gm command to debug expedition cache for current zone
2020-12-30 18:47:06 -05:00
hg a77f8b582e Update opcodes and packet structs for expeditions
Add and rename some opcodes

Add packet translations for expeditions

Fix OP_DzExpeditionEndsWarning opcode for RoF2

Add RoF2 OP_KickPlayers
2020-12-30 18:47:06 -05:00
Alex 51a74c23ef quest::getspellname() and quest::getclassname() fixes/additions. (#1158)
- Update GetSpellName() to uint16.
- Add more classes to GetClassIDName().
2020-12-30 14:47:27 -06:00
Alex c593ed6a05 Add SetRadiantCrystals() and SetEbonCrystals() to Perl/Lua. (#1159)
- Add $client->SetRadiantCrystals(value) to Perl.
- Add $client->SetEbonCrystals(value) to Perl.
- Add client:SetRadiantCrystals(value) to Lua.
- Add client:SetEbonCrystals(value) to Lua.

Co-authored-by: Chris Miles <akkadius1@gmail.com>
2020-12-30 14:46:09 -06:00
Chris Miles c1d7a82307 [DevTools] Improve DevTools Toggling Options (#1161)
* Improve devtools toggling

* Cleanup a few more references
2020-12-30 14:43:33 -06:00
Alex a920d449ff Add removeitem(item_id, quantity) to Perl/Lua. (#1156)
- Perl: quest::removeitem(item_id, quantity);
- Lua: eq.remove_item(item_id, quantity);
2020-12-29 18:21:47 -06:00
Paul Coene 21a1a7bed7 Client tracks pet sit/stand - force new pets to stand rather than use client (#1155)
Co-authored-by: Noudess <noudess@gmail.com>
2020-12-22 18:05:02 -06:00
Paul Coene 8a0f242fc6 Added RACE_BOAT_533 to IsBoat() (#1154)
Co-authored-by: Noudess <noudess@gmail.com>
2020-12-22 14:45:17 -06:00
Michael Cook (mackal) 4ec9ccae98 Merge pull request #1153 from thalix1337/master
Fix for Feature/underworld, typo in SQL
2020-12-22 12:56:09 -05:00
thalix1337 cc344ac98a Fix for Feature/underworld, typo in SQL 2020-12-22 18:06:26 +01:00
Michael Cook (mackal) 69a8507908 Feature/underworld (#1146)
* Update NewZone_Structs

* Update packet translators for NewZone_Struct

* Add OP_UnderWorld OPcodes

These aren't implemented yet, but I thought it would be good to document
them. This sends up just entity ID and location when you fall
underworld. This could possibly be used to check for someone screwing
with zone data locally to warp or something I guess.

* Add database fields
2020-12-21 17:08:04 -06:00
Thalic f87662f676 Minor ortographic corrections of ruletypes.h (#1147)
* Update ruletypes.h

* Update ruletypes.h
2020-12-21 17:07:45 -06:00
Paul Coene 1eb5e4a0c1 Remove the extra erroneous message (DoT landing message) at mob death if mob dies of DoT. (#1138)
* Removed the erroneous message of a DoT "landing" when a mob dies from that DoT

* Set spell=-1 on Death struct for NPCs.  It was causing extra DoT msg.

* Remove whitespace

Co-authored-by: Noudess <noudess@gmail.com>
2020-12-21 17:07:15 -06:00
neckkola a1cc68d214 Added new Perl/LUA GetSpellIDByBookSlot (#1151)
Added a new questAPI GetSpellIDByBookSlot to allow for sorting spellbooks by various attributes (level, type, etc).  Allows to determine which spell is in what book slot.
2020-12-21 17:06:48 -06:00
Alex c6d4d8f291 Merge pull request #1148 from noudess/waterroam
Destination check needed to be actual ground z at loc.  -15 wasnt enough
2020-12-13 16:38:55 -08:00
Noudess fff53fc465 Destination check needed to be actual ground z at loc. -15 wasnt enough 2020-12-13 10:17:04 -05:00
Chris Miles 5a4c651d6b Drone Build Pipeline (#1144)
* Create drone config

* Tweak config

* Update .drone.yml

* Garbage commit to run another build

* Bring cores down

* Fix formatting from https://github.com/EQEmu/Server/pull/1142

* Add tests line

* Change directory to build before running the unit tests

* Remove tests dir

* Avoid double build on PR's

* Testing build settings
2020-12-07 22:36:59 -06:00
Alex ff4c9e1e70 Merge pull request #1142 from noudess/waterroam
Allow water based roamboxes again.
2020-12-07 14:07:59 -08:00
Noudess 8bc60acd77 Fix so roamboxes allow water boxes again. 2020-12-07 11:10:59 -05:00
E Spause f26b3195c9 Add safeguard for issue with mobs pathing to 0,0,0 on teleport nodes with values 0,0,0 (#1140)
* IP limit and account session limit refactor - uses responses built into loginserver

* Fix an issue where teleport nodes with 0.0f as a value were added to routes when pathing.
2020-12-05 15:15:53 -06:00
Michael Cook (mackal) 31019b8832 Merge pull request #1137 from EQEmu/bug_fix/rest_timer
Save the rest_timer sooner to prevent issues
2020-11-22 14:35:24 -05:00
Michael Cook (mackal) df4ccaf970 Merge pull request #1136 from EQEmu/bug_fix/quest_reward_charges
Update the SummonItem call to default charges for QuestRewards
2020-11-22 14:08:33 -05:00
Michael Cook (mackal) eb0d12f220 Save the rest_timer sooner to prevent issues
We need to save the remaining time sooner to prevent circumstances
described here:

http://www.projecteq.net/forums/index.php?threads/raid-out-of-combat-regen-timers-resetting-on-non-raid-mobs.16114/
2020-11-17 15:47:12 -05:00
Michael Cook (mackal) 60254105f1 Update the SummonItem call to default charges for QuestRewards
This should summon the item at max charges, if it has charges
2020-11-05 19:40:04 -05:00
Akkadius 1fc4073a05 Garbage commit to push a build 2020-11-03 19:46:47 -05:00
Chris Miles be12cad7bd Fix for quest::GetZoneLongName(zone_short_name) garbled output (#1134) 2020-10-31 18:47:43 -05:00
Akkadius 25c596656c Merge branch 'master' of https://github.com/EQEmu/Server 2020-10-25 23:49:08 -05:00
Akkadius ee7ef97506 Revert "Spell Fizzle for < LDON expansions via lua_mod (#1118)"
This reverts commit e9d312fa86.
2020-10-25 23:48:57 -05:00
Chris Miles 80ce499f67 Scanning Optimizations (#1133)
* Scanning optimizations this more properly applies idle / moving scanning algorithms and applies update_others when a client is moving

* Fix bots

* Perform a self and other scan when npc's pop
2020-10-25 23:01:30 -05:00
Chris Miles 62efae2e00 SendIllusion Update Internal Values (#1130)
* Fix scenarios where quest calls to SendIllusion also update internal values so that new clients that zone in see the correct appearance

* Typo [skip ci]
2020-10-25 21:48:29 -05:00
Ali Al-Khalifa e9d312fa86 Spell Fizzle for < LDON expansions via lua_mod (#1118)
* [expansions] Create a Lua mod hook into Client::CheckFizzle()

* Added expansions_combat.lua mod stub

* Spell  Fizzle as per TAKP formula
2020-10-24 19:49:43 -05:00
Chris Miles c1c010bc8d Merge pull request #1128 from EQEmu/editmassrespawn_upd
Fix for command '#editmassrespawn'
2020-10-10 20:19:14 -05:00
Uleat f03669b8f4 Fix for command '#editmassrespawn' 2020-10-10 21:13:13 -04:00
Paul Coene b996f40016 Merge pull request #22 from EQEmu/master
Merge base back into my fork
2020-10-09 11:30:38 -04:00
Chris Miles a4a4a2266b Merge pull request #1122 from EQEmu/bug/item_loss_message
Only UF and earlier have the CORPSE_ITEM_LOST string
2020-10-06 02:30:26 -05:00
Chris Miles 82512899b2 Merge pull request #1126 from snail23/master
Compile fix on linux
2020-10-06 02:30:01 -05:00
JJ 4ac62a2ddc Merge pull request #1123 from noudess/amphibious
Allow amphibious mobs underwater to follow los and not fall to water bottom when pathing
2020-10-05 20:17:37 -04:00
Snail 1d4bea21c1 compile fix on linux (glm is using c++14 code), update CXX_STANDARD 2020-10-04 18:50:19 -04:00
Noudess d507222d21 Allow amphibious creatures to swim to next node of pathing. 2020-09-21 10:36:00 -04:00
Paul Coene 27e19900ae Merge pull request #21 from EQEmu/master
Merge from base.
2020-09-21 10:27:18 -04:00
Michael Cook (mackal) 32f4722c0f Only UF and earlier have the CORPSE_ITEM_LOST string
Let's not confuse players with missing messages I guess
2020-09-20 13:55:45 -04:00
Chris Miles 5e93746e8c Merge pull request #1119 from noudess/master
Fix bugged pet sit button and taunt.
2020-09-19 18:48:13 -05:00
Michael Cook (mackal) 1106e404c7 Merge pull request #1121 from EQEmu/bug_fix/pet_affinity_solo_fix
Fix issue where a group buff was casted on a solo player
2020-09-10 14:25:37 -04:00
KimLS 0e2c918479 Added alias to lua skills that don't start with a number so i can use them with typescript which don't allow identifiers starting with 0-9 2020-09-09 21:29:29 -07:00
Noudess 05dfe748d3 Use aabonuses.PetCommands instead of checking AA level 2020-09-08 19:10:48 -04:00
Noudess cd2b2c3c19 Fix indentation. 2020-09-08 16:48:09 -04:00
Michael Cook (mackal) 6f2b39792a Fix issue where a group buff was casted on a solo player
The pet affinity in this case was checking the caster's AAs not the
target's like it should
2020-09-08 15:57:17 -04:00
Noudess ff6de1938b Change older clients to default to taunting=true only for taunt eligble pets. 2020-09-03 15:38:35 -04:00
Noudess d5451c5d77 Remove left over logging. 2020-09-02 14:56:12 -04:00
Noudess 96fb156c47 Change Older clients to not use persistant taunt button & default to taunt on. 2020-09-02 14:50:51 -04:00
Noudess 56afa0404b Updates to fix taunt button on PET UI to match live behavior. 2020-09-02 12:50:11 -04:00
Noudess 29f7bc7a9c Fix bugged pet window sit button and pet sit based regen. 2020-08-31 13:39:42 -04:00
Paul Coene ad74af7797 Merge pull request #20 from EQEmu/master
Merge from base
2020-08-28 18:59:13 -04:00
Chris Miles 3fe0f59deb Merge pull request #1117 from EQEmu/xackery/vscode-update
changed build dir to /bin, updated peq db dump
2020-08-24 08:03:53 -05:00
Xackery Xtal ebf1cc2bc6 changed build dir to /bin, updated peq db dump 2020-08-23 18:17:23 -07:00
Akkadius 32407dbb56 Add rule Character:FinalExpMultiplier - Added on top of everything else, easy for setting EXP events 2020-08-21 01:04:18 -05:00
Chris Miles 482816058f Merge pull request #1113 from EQEmu/fix/ZonePoint_memleak
Fix memory leak for virtual zone line branch
2020-08-21 00:25:27 -05:00
Chris Miles 8ed2ea5cfe Merge pull request #1114 from noudess/patch-1
Removed duplicate code for pruning merhantlist_temp
2020-08-21 00:24:59 -05:00
Chris Miles 5d4a78fb3f Merge pull request #1112 from noudess/untargettable
Add check so that the 'u' key does not open a trade window with an untargettable mob.
2020-08-21 00:24:28 -05:00
Chris Miles ebea77e8ea Merge pull request #1115 from EQEmu/bugfix/command_task
Fix missing arg to client message in #task
2020-08-21 00:24:03 -05:00
Akkadius 51356610b2 Fix overflow issue with character corpse creation using the wrong struct in allocation 2020-08-21 00:23:13 -05:00
Michael Cook (mackal) 84a75f2a77 Fix missing arg to client message in #task 2020-08-19 17:13:28 -04:00
Paul Coene 9be5ac4ca6 Update main.cpp 2020-08-19 14:58:04 -04:00
Paul Coene b8586bf9cb Update main.cpp 2020-08-19 14:57:21 -04:00
Paul Coene 7cc23fcbeb Removed duplicate code for pruning merhantlist_temp
The code already exists, guarded by a rule.
2020-08-19 14:48:28 -04:00
Michael Cook (mackal) 539de20a11 Fix memory leak for virtual zone line branch 2020-08-18 23:32:45 -04:00
Chris Miles b57bcced40 Merge pull request #1111 from EQEmu/bug_fix/aepcv1_mobai_distance
Fix NPC AI casting of ST_AEClientV1
2020-08-18 13:21:53 -05:00
Noudess 9ab61d4ed4 Fix so an untargettable mob is not opened for trade when client pressed the 'u'
key.  Discovered this on untargettable mobs at doors.
2020-08-18 11:15:33 -04:00
Paul Coene 09e0b09649 Merge pull request #19 from EQEmu/master
merge from base
2020-08-18 10:55:21 -04:00
Michael Cook (mackal) b9f01e0d1c Merge pull request #1107 from fryguy503/percentheal_aggro
[Aggro] PercentalHeal should be included in aggro generation
2020-08-17 21:17:40 -04:00
Michael Cook (mackal) f7e997fba1 Fix NPC AI casting of ST_AEClientV1
As noted, I think we do this check incorrectly, but this should work
fine and matches other similar spells, let's get it good enough first.
2020-08-17 18:04:52 -04:00
Akkadius 78776df107 Update world content service API's to consider all expansions enabled 2020-08-16 20:04:49 -05:00
Trust bd4810351d [Aggro] PercentalHeal should be included in aggro generation
Per January 15th 2003 Patch Notes:
"NPCs will now notice Druid and Shaman Percentage Heal spells in a manner similar to traditional healing spells."

Added SE_PercetalHeal to the same CheckHealAggroAmount as SE_CurrentHP to be similar to traditional healing spells.
2020-08-16 18:32:26 -04:00
Chris Miles 0506c01103 Merge pull request #1102 from fryguy503/AERamp
[Combat] AE Ramp now allows Max Melee Range
2020-08-16 02:03:54 -05:00
Chris Miles 24a8ca39d3 Merge pull request #1100 from noudess/empty_processing
Allow quests to turn on mob processing in empty zones
2020-08-16 02:03:22 -05:00
Chris Miles ecf47a0bbb Merge pull request #1097 from SecretsOTheP/null_ptr_fixes
Null ptr fixes
2020-08-16 02:02:46 -05:00
Chris Miles 6a4a4de31c Merge pull request #1106 from EQEmu/feature/virtual-zonepoints
Add support for virtual zonepoints
2020-08-16 01:42:33 -05:00
Akkadius efdead0b0a Add expansion info 2020-08-16 01:12:30 -05:00
Akkadius e319746ca9 Typos 2020-08-16 00:16:50 -05:00
Akkadius f78828216d Add support for virtual zonepoints 2020-08-16 00:06:20 -05:00
Akkadius 9d0f7781b4 Fix compiler warnings 2020-08-15 19:03:25 -05:00
Akkadius f6e544a2e6 Merge branch 'master' of https://github.com/EQEmu/Server 2020-08-15 18:49:24 -05:00
Akkadius 3ffb5299a8 Update repositories 2020-08-15 18:28:34 -05:00
Chris Miles aeb1ce0fbe Merge pull request #1105 from EQEmu/feature/lootdrop-changes
Lootdrop Filtering Adjustments
2020-08-15 17:55:18 -05:00
Akkadius 4b764e2cc5 Set loot default log [skip ci] 2020-08-15 17:48:10 -05:00
Akkadius 45f08b4645 Cleanup some logic 2020-08-15 17:43:20 -05:00
Akkadius 0e31302a7d Add an easy way to pull item saylinks 2020-08-15 17:25:09 -05:00
Akkadius 94d87584aa Lootdrop level filtering adjustments 2020-08-15 16:37:38 -05:00
Trust 3245fa6123 [Combat] AE Ramp now allows Max Melee Range
RuleR AERampageSafeZone - Reduce AE Ramp range by this amount to allow for a small safe zone on AE Ramp.
2020-08-09 14:04:03 -04:00
Akkadius bda13383ef Revert "Merge pull request #1101 from KinglyKrab/custom"
This reverts commit 43108acae1, reversing
changes made to daa1db65b9.
2020-08-03 22:21:51 -05:00
Alex 43108acae1 Merge pull request #1101 from KinglyKrab/custom
Custom changes.
2020-08-03 23:17:37 -04:00
Alex ff7c3aff92 Custom changes. 2020-08-03 23:14:39 -04:00
Chris Miles daa1db65b9 Merge pull request #1094 from EQEmu/integration/multi-tenancy-expansions-repository
Integration/multi tenancy expansions repository
2020-07-30 22:27:58 -05:00
Chris Miles fd48912bd2 Merge pull request #1098 from EQEmu/lua_update_zone_header
Add Lua eq.update_zone_header export to lua_general.cpp.
2020-07-30 22:07:47 -05:00
Akkadius cfa3e88bb2 Add command #gearup as a fairly decent start to a expansion specific way of gearing up a GM test character 2020-07-30 21:10:15 -05:00
Noudess 8e7591cd4b Added support for quests to enable and then redisable processing of movement. 2020-07-27 10:43:24 -04:00
Paul Coene 44a1256eb9 Merge pull request #18 from EQEmu/master
Merge mainline into my fork
2020-07-27 09:53:56 -04:00
Akkadius a307636962 Fix object update spam issue (terrible code) 2020-07-20 22:53:58 -05:00
Akkadius a617fc5034 Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-07-19 20:40:00 -05:00
Alex 63ad92090a Add Lua eq.update_zone_header export to lua_general.cpp. 2020-07-19 18:01:06 -04:00
E Spause 147916ce2e Set group info to null in various places
When the group is disbanded, set the leader to null.

When setting a new raid leader, make sure we have a new raid leader. If we don't, avoid a crash and disband the raid. It's better than zones falling apart, and will resolve itself on the next VerifyRaid call.

If a member zones, set the leader pointer to nullptr. This fixes an issue where the leader pointer is freed later (MemberZoned normally cleans up the Client object), but referenced by other entities, allowing the leader to be used in the same server process tick, post-cleanup - as the leader won't exist.
2020-07-19 02:34:59 -04:00
Akkadius 98340751b0 Sanity check on adding self to other lists 2020-07-19 01:34:25 -05:00
E Spause 42781036a8 Fix issue where npc_types could become null in the cache but remain referenced, causing a crash due to invalid memory accessed 2020-07-19 02:31:22 -04:00
E Spause eacd2c2cde Fix null pointers in group/raid pointer removal 2020-07-19 02:30:50 -04:00
Akkadius 2e0c892b07 Add cli character:copy-character and #copycharacter 2020-07-18 21:07:22 -05:00
Akkadius 880b19cc7f Hit the zone cache first so we're not hitting the database every time someone attempts to zone 2020-07-18 13:16:27 -05:00
Chris Miles fc6689ec09 Merge pull request #1096 from noudess/master
Added Rule to enable AA Ding()
2020-07-18 11:50:37 -05:00
Noudess db4f113129 Added rule to allow the Ding sound when AA is earned. 2020-07-13 08:12:02 -04:00
Akkadius 30e0bbb912 More conversion changes to reduce warnings [skip ci] 2020-07-12 17:33:17 -05:00
Akkadius 6a7a78af29 Static cast floats in atof usages where the datatype is actually float to avoid windows compiler warnings 2020-07-12 17:25:50 -05:00
Akkadius 758a30a080 Fix merge 2020-07-12 16:57:36 -05:00
Akkadius 3016f9409b Fix merge 2020-07-12 16:57:04 -05:00
Chris Miles 7ba55759c5 Merge pull request #1095 from EQEmu/world_wide_lua_overrides
Add Lua overrides to worldwide methods to make additional parameters optional.
2020-07-12 16:53:47 -05:00
Akkadius 8647bd73ce Merge remote-tracking branch 'origin' into integration/multi-tenancy-expansions-repository 2020-07-12 16:51:36 -05:00
Alex e033d89a32 Add Lua overrides to worldwide methods to make additional parameters optional. 2020-07-08 18:16:20 -04:00
Paul Coene a8928d4a39 Merge pull request #17 from EQEmu/master
Merge master into our fork
2020-07-08 15:48:20 -04:00
Chris Miles b801f8dfe5 Merge pull request #1092 from EQEmu/cross_zone_overhaul
Completely overhaul cross zone and world wide methods in quest API.
2020-07-07 14:15:29 -05:00
Chris Miles b0b63cc64c Merge pull request #1093 from EQEmu/hot_reload_adjustments
Add hot reload saylinks as well as a rule to determine if you bypass the saylinks.
2020-07-07 14:13:15 -05:00
Alex c8389bc674 Completely overhaul cross zone and world wide methods in quest API. 2020-07-07 08:02:56 -04:00
Alex f1929c4f45 Add hot reload saylinks as well as a rule to determine if you bypass the saylinks. 2020-07-07 07:20:08 -04:00
Akkadius f6b5bbef00 Add world api get_database_schema 2020-07-07 02:21:44 -05:00
Akkadius bdf55403cf Add manifest criteria 2020-07-07 02:10:00 -05:00
Akkadius 084e9b7a35 Fix command exit codes 2020-07-07 02:09:39 -05:00
Akkadius a54d92d078 Cleanup content flag loading logic 2020-07-07 02:06:16 -05:00
Akkadius 331eb51126 Add connection label to MySQL connects 2020-07-07 02:06:00 -05:00
Akkadius b7e2261e16 Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-07-07 01:32:17 -05:00
Akkadius 4e6c3b524f Add fix for scenario where a client traveled far distance quickly and mob scanning is too slow; this takes care of all scenarios 2020-07-07 01:19:02 -05:00
Chris Miles 520ac3ae46 Merge pull request #1091 from EQEmu/feature/windows-shared-memory-hotfix-fix
Windows #hotfix Fix
2020-07-04 02:27:17 -05:00
Akkadius 15a70c7aa9 Fix for windows hotfix [skip ci] 2020-07-04 02:24:53 -05:00
Akkadius 9e960b90bd Adjust path quote [skip ci] 2020-07-04 02:01:35 -05:00
Akkadius 8e96232690 Add explicit file extension to file check [skip ci] 2020-07-04 01:58:02 -05:00
Akkadius 6aad062e9a Add logging [skip ci] 2020-07-04 01:50:29 -05:00
Chris Miles 818fd53dd0 Merge pull request #1090 from xevianindustries/titanium_start_zone_fix
Issue 743 - WorldDatabase::GetStartZone now checks isTitanium when creating the SQL
2020-07-02 21:34:52 -05:00
Akkadius 36e064a7b3 Fix issue where #hotfix doesn't work properly in new Windows installations 2020-07-02 21:31:50 -05:00
Erick Christgau 12a0e3e226 Issue 743 - WorldDatabase::GetStartZone now checks isTitanium when creating the SQL 2020-07-02 10:16:04 -05:00
Chris Miles a78c3b9800 Merge pull request #1086 from EQEmu/cross_zone_move
Optimize cross-zone utilities and add cross-zone player move utilities to Perl/Lua.
2020-06-30 14:48:16 -05:00
Chris Miles 62439fe8ee Merge pull request #1088 from EQEmu/move_zone_instance
Add MoveZoneInstance methods to Perl/Lua.
2020-06-30 14:47:16 -05:00
Chris Miles 4b1ea13c32 Merge pull request #1089 from EQEmu/dye_armor
Add DyeArmorBySlot(slot, red, green, blue, use_tint) to Perl/Lua.
2020-06-30 14:46:43 -05:00
Chris Miles 7a5a0915e5 Merge pull request #1085 from EQEmu/display_ac
Add GetDisplayAC() to Perl/Lua.
2020-06-30 14:46:08 -05:00
Paul Coene 0202a2ad23 Merge pull request #16 from EQEmu/master
Merge master into main
2020-06-30 07:56:00 -04:00
Alex eed1fd8a43 Add DyeArmorBySlot(slot, red, green, blue, use_tint) to Perl/Lua. 2020-06-29 20:55:30 -04:00
Alex 1b2c2a1dd0 Add MoveZoneInstance methods to Perl/Lua. 2020-06-29 19:49:37 -04:00
Alex f514dd5b55 Optimize cross-zone utilities and add cross-zone player move utilities to Perl/Lua. 2020-06-29 17:54:30 -04:00
Alex eb039d176c Add GetDisplayAC() to Perl/Lua. 2020-06-29 15:49:24 -04:00
Akkadius 954b0c5106 Post merge fixes 2020-06-29 00:55:53 -05:00
Akkadius e03ca7f65e Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-06-29 00:40:27 -05:00
Akkadius f32126faac Fix issue where when a client first enters a zone, a mob may not be aware of their distance to a client immediately so when the client does their scan we also add ourselves to their lists 2020-06-28 23:10:30 -05:00
Akkadius e11868eb65 Merge branch 'master' of https://github.com/EQEmu/Server 2020-06-28 22:56:35 -05:00
Akkadius 05113aab7d Lower animation throttle frequency 2020-06-28 22:56:33 -05:00
Chris Miles ba62d0bdd3 Merge pull request #1074 from thalix1337/master
Improvement of rule descriptions
2020-06-28 22:03:31 -05:00
Chris Miles 53eb28c5c6 Merge pull request #1079 from KinglyKrab/disc_timer
Add GetDisciplineTimer() and ResetDisciplineTimer() to Perl/Lua.
2020-06-28 22:00:45 -05:00
Chris Miles f6d415410d Merge pull request #1080 from KinglyKrab/assign_tasks
Add cross-zone task assign methods to Perl/Lua.
2020-06-28 21:54:52 -05:00
Chris Miles f143cddc97 Merge pull request #1082 from KinglyKrab/move_zone
Add MoveZone methods to Perl/Lua.
2020-06-28 20:05:16 -05:00
Chris Miles 2a19ad0197 Merge pull request #1083 from EQEmu/recalculate_skills
Fix $npc->RecalculateSkills() in Perl.
2020-06-28 20:04:41 -05:00
Akkadius 30067f9b6d Fix UCS connection bug 2020-06-28 19:14:36 -05:00
Alex 1292e1c9c0 Fix $npc->RecalculateSkills() in Perl. 2020-06-28 10:08:21 -04:00
Alex 9a2294774e Add client-based MoveZone methods. 2020-06-27 21:35:52 -04:00
Alex 2c7d227f4a Merge pull request #1 from EQEmu/master
Update.
2020-06-27 20:41:58 -04:00
Alex 25c3d3803f Add cross-zone task assign methods to Perl/Lua. 2020-06-27 20:03:06 -04:00
Alex 736c345a45 Add GetDisciplineTimer() and ResetDisciplineTimer() to Perl/Lua. 2020-06-27 16:37:24 -04:00
thalix1337 c3e7cd65e8 Corrected duplicate descriptions
Corrected descriptions for the rules UseOldConSystem and UseLiveBlockedMessage
2020-06-27 03:18:40 +02:00
freyonsecurity 9bbef1d79a Missing descriptions added
All missing descriptions added. Made corrections to existing descriptions.
2020-06-26 22:05:35 +02:00
Chris Miles 6bdc1ffffb Merge pull request #1067 from noudess/CallForHelp
Prevent mob from moving from point of aggro until after calls for help are issued.
2020-06-23 14:20:40 -05:00
Chris Miles a9c2e35bc7 Merge pull request #1075 from KinglyKrab/findzone
Add zone ID to #findzone.
2020-06-23 14:18:47 -05:00
Chris Miles 10f54313a5 Merge pull request #1076 from KinglyKrab/zone
Add new zone methods to Perl/Lua.
2020-06-23 14:18:33 -05:00
Chris Miles 2fd149469d Merge pull request #1073 from noudess/gridshow
Repair #grid show command
2020-06-23 14:15:48 -05:00
Chris Miles 08e5176c0c Merge pull request #1077 from KinglyKrab/findrace
Add #findrace command.
2020-06-23 14:10:36 -05:00
Alex 0daadde415 Add #findrace command. 2020-06-21 16:10:55 -04:00
Alex 1ae077ea8f Add new zone methods to Perl/Lua. 2020-06-21 01:15:29 -04:00
Alex 0d28f0c083 Add zone ID to #findzone 2020-06-21 00:26:13 -04:00
Thalix 01698ae989 Incorrectly deleted rules inserted again 2020-06-21 04:03:03 +02:00
Thalix ab73fd7938 Improvement of rule descriptions
Incomplete descriptions added as far as the function was clear to me. Tried to standardize the words used in the descriptions. Corrected a few orthographic problems. Added some words to existing descriptions to make them more understandable. Some rules which were not used anymore are deleted.
2020-06-21 03:19:38 +02:00
Noudess 06f3d40c28 Replaced expensive IsPet() with GetOwnerID(). 2020-06-19 07:59:08 -04:00
Noudess efc3832f52 Fix some formatting and change visual label for stacked node names. 2020-06-19 07:43:06 -04:00
Chris Miles 64b56bd746 Merge pull request #1071 from noudess/master
SQL to add faction mods for guktan and drakkin races, and Agnostic mods
2020-05-30 08:09:20 -05:00
Chris Miles 577fbdac01 Merge pull request #1072 from alimalkhalifa/cmake_mariadb
Updated CMakeLists to default to MariaDB instead of MySQL
2020-05-30 08:08:34 -05:00
Noudess fa2caf8f83 Comment movement code and make target required in all cases again 2020-05-28 13:30:34 -04:00
Noudess 4ad38d4c49 Fix for pets, mercs, bot that don't set combat state. 2020-05-28 13:17:31 -04:00
Noudess 4a23086183 Fixes to #grid show. Added new string utilities. 2020-05-28 08:41:10 -04:00
Paul Coene 9195e5e961 Merge pull request #15 from EQEmu/master
Merge master into my branch
2020-05-28 08:19:35 -04:00
Ali 42352359ad [ci skip] Updated CMakeLists to default to MariaDB instead of MySQL 2020-05-28 15:18:25 +03:00
KimLS 88b405edee Merge branch 'master' of https://github.com/EQEmu/Server 2020-05-26 22:30:24 -07:00
KimLS 8a0d4e37bd Remove optimization off of quest::ChooseRandom on msvc to solve a crash on x64 in release mode 2020-05-26 22:30:19 -07:00
Chris Miles c10a9cb620 Update README.md 2020-05-26 00:32:45 -05:00
Akkadius 01d326ef83 Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-05-25 23:06:14 -05:00
Akkadius 2ec9a2addd Zone point logging 2020-05-25 23:05:05 -05:00
KimLS 6a416a78a8 Merge branch 'master' of https://github.com/EQEmu/Server 2020-05-25 20:56:54 -07:00
KimLS 5e9bf3b044 Make ChooseRandom more idiomatic, the fact that the code can return a SV of anytype makes it a bit dangerous, good canidate for rewriting as a plugin 2020-05-25 20:56:49 -07:00
Chris Miles a3874b5252 Merge pull request #1070 from alimalkhalifa/installer/support_powershell2
Updated installer to support powershell older than 3.0
2020-05-25 18:38:14 -05:00
Paul Coene 0e04e42bea Added two missing agnostic mods 2020-05-25 16:48:03 -04:00
Paul Coene 40e690f8e3 SQL to add the needed guktan and drakkin faction fixes missed by faction_conversion. 2020-05-25 16:25:55 -04:00
Ali 6896ef650e [ci skip] Updated installer to support powershell older than 3.0 2020-05-25 16:19:33 +03:00
Akkadius cfe3b2b071 Reconile a post merge issue [skip ci] 2020-05-25 01:35:39 -05:00
Akkadius a9790e2779 Update lua_general.cpp 2020-05-24 21:57:09 -05:00
Akkadius a4b027db58 Export quest::is_content_flag_enabled and quest::set_content_flag 2020-05-24 20:45:44 -05:00
Akkadius 50c266982f Remove string quotes from integers in mysql queries for faction and rules [skip ci] 2020-05-24 19:21:26 -05:00
Akkadius 905baa71b2 Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-05-24 04:24:01 -05:00
Akkadius db072e767a Bulk instance deletion instead of tons of individual statements [skip ci] 2020-05-24 04:23:52 -05:00
Akkadius 02fa823736 Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-05-24 04:07:38 -05:00
Akkadius 0d2d6a2c6b More resilient fix to killing instances for now [skip ci] 2020-05-24 04:07:29 -05:00
Akkadius 12d10bbc50 Slight adjustment to filter criteria [skip ci] 2020-05-24 03:08:52 -05:00
Akkadius d98e69ae5d Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-05-24 02:56:13 -05:00
Chris Miles 26831d5ad4 Fix a copy paste error 2020-05-24 02:56:04 -05:00
Akkadius e82f0254b0 Add content_flags_disabled field for additional filtering 2020-05-24 02:24:38 -05:00
Akkadius 630ab5e69d Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-05-24 01:37:10 -05:00
Akkadius e474df2b12 Tweak content flag filtering [skip ci] 2020-05-24 01:36:17 -05:00
Chris Miles e8a05ec680 Fixes instance deletion issue https://github.com/EQEmu/Server/issues/1069 2020-05-24 01:32:50 -05:00
KimLS 712df6c35a Fix compile issue for latest vc compiler 2020-05-23 23:19:54 -07:00
Akkadius 56c4eb280f Fix post merge issues 2020-05-23 22:41:59 -05:00
Akkadius 03a4254397 Post merge fix [skip ci] 2020-05-23 22:34:32 -05:00
Akkadius 3f62da4573 Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-05-23 22:33:34 -05:00
Akkadius 86ef1b12e2 Strawberry Perl OOB has issue with getstore so lets use something else [skip ci] 2020-05-23 16:50:09 -05:00
Akkadius b585d9b062 Use wget again for windows [skip ci] 2020-05-23 16:29:04 -05:00
Chris Miles 4603fa2ef8 Merge pull request #1068 from alimalkhalifa/reintroduce_wget_to_windows_installer
Revert back to using wget.exe for windows installs
2020-05-23 16:23:57 -05:00
Ali 2c2c09531f [ci skip] Revert back to using wget.exe for windows installs 2020-05-21 15:16:50 +03:00
Noudess 4e8764b6b9 Repair aggro so CallsForHelp are completed before mob charges. 2020-05-20 16:08:42 -04:00
Paul Coene 3ebbcd84d4 Merge pull request #14 from EQEmu/master
Merge Mainline into my base
2020-05-20 15:52:59 -04:00
Alex d7c5a45cc2 Merge pull request #1064 from EQEmu/getskill
Remove duplicate GetSkill() definition.
2020-05-19 19:35:08 -04:00
Alex 5964bcc3c4 Merge branch 'master' into getskill 2020-05-19 18:50:32 -04:00
Chris Miles 0c531e976b Merge pull request #1065 from EQEmu/signalclient
Remove duplicate SignalClient() definition.
2020-05-19 02:38:44 -05:00
Chris Miles a64c0dfd92 Merge pull request #1063 from EQEmu/maketemppet
Remove duplicate MakeTempPet() definition.
2020-05-19 02:37:46 -05:00
Chris Miles 19107e5ace Merge pull request #1037 from alimalkhalifa/win64
Win64 eqemu_server.pl
2020-05-19 01:24:30 -05:00
Chris Miles 852a8e1617 Update eqemu_server.pl [skip ci] 2020-05-19 01:17:02 -05:00
Chris Miles 4180ef58ef Update eqemu_server.pl [skip ci] 2020-05-19 00:58:19 -05:00
Alex 6a817fdce5 Merge pull request #1051 from hgtw/fix/missing-doors
Fix edge case with door packets that can cause missing doors on clients
2020-05-17 20:36:04 -07:00
Alex 5bdc9c6c60 Remove duplicate SignalClient() definition. 2020-05-16 14:42:38 -04:00
Alex ceff8b8674 Remove duplicate GetSkill() definition. 2020-05-16 14:40:36 -04:00
Alex 968efe8831 Remove duplicate MakeTempPet definition. 2020-05-16 14:30:35 -04:00
Chris Miles 5dbd2c38ed Update script [skip ci] 2020-05-11 04:51:59 -05:00
Chris Miles f785dc232b More tweaks [skip ci] 2020-05-11 03:37:09 -05:00
Chris Miles d534d345d5 More tweaks [skip ci] 2020-05-11 03:35:16 -05:00
Chris Miles 51b98ec724 Lots of tweaks for overhauls [skip ci] 2020-05-11 03:21:46 -05:00
Chris Miles 2c13f2e928 Update server script [skip ci] 2020-05-11 01:13:59 -05:00
Chris Miles 496a958def Update eqemu_server.pl 2020-05-11 00:28:24 -05:00
Chris Miles 39cd5bb9a8 Fix issue where powershell progress output was dramatically slowing down requests [skip ci] 2020-05-10 23:07:48 -05:00
hg b08dc02a0a Fix edge case with door packets that can cause missing doors on clients
Send OP_RemoveAllDoors packets with default CLIENT_CONNECTINGALL flag
to match flag used for OP_SpawnDoor
2020-05-09 16:26:55 -04:00
Akkadius d8b9c3e3de Fix bad object Z data automatically using Z calcs, works fairly reliably 2020-04-25 04:24:22 -05:00
Akkadius 206761d5e8 Force str_tolower on zone name lookups 2020-04-24 20:09:59 -05:00
Akkadius bf0322f8f6 Not sure why we are trying to detete id 0 objects [skip ci] 2020-04-24 18:15:07 -05:00
Akkadius 5dc351e5d5 Remove cross boundary dependency in command_who [skip ci] 2020-04-24 02:22:33 -05:00
Akkadius 22180d4bac Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-04-24 02:11:44 -05:00
Akkadius 43ff59d7db Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-04-24 01:27:17 -05:00
Akkadius 2159b5db2d Add damageshieldtypes to content tables 2020-04-21 02:10:52 -05:00
Akkadius b6b008e74a Add tenancy support to the dump service 2020-04-19 19:52:19 -05:00
Akkadius 6409e02aed Update base repositories to use int as a base to avoid atoi overflow 2020-04-19 04:49:28 -05:00
Akkadius 373fb3f0e7 Decouple zone calls, cleanup logic 2020-04-19 04:36:39 -05:00
Akkadius ebda1cf601 Add zone store 2020-04-19 03:05:15 -05:00
Akkadius 6a51bcf8fd Fix null reference issue [skip ci] 2020-04-19 01:02:35 -05:00
Akkadius caa0ffda00 Add Truncate repository method and purge player sold items on world bootup 2020-04-18 23:53:52 -05:00
Akkadius 85daee85b8 Move spawn events from content table to server 2020-04-18 23:26:53 -05:00
Akkadius e4748a01e0 Fix tradeskill combine logic [skip ci] 2020-04-18 21:50:00 -05:00
Akkadius 472c0cd196 More tweaks [skip ci] 2020-04-18 20:03:34 -05:00
Akkadius df43a23d98 Another adjustment [skip ci] 2020-04-18 19:52:56 -05:00
Akkadius 74c878a481 Fix [skip ci] 2020-04-18 19:49:20 -05:00
Akkadius 093509baa9 Few adjustments [skip ci[ 2020-04-18 19:46:19 -05:00
Akkadius b8c44ee41b Fix container interaction [skip ci] 2020-04-18 18:19:59 -05:00
Akkadius bcd62b76c4 Fix all expansion enabled filtering [skip ci] 2020-04-18 18:12:25 -05:00
Akkadius a0f8bbb3b9 Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-04-18 02:31:43 -05:00
Akkadius 4db646db94 Revert "Merge pull request #1007 from EQEmu/feature/improved-name-generator"
This reverts commit 3c71e2c91d, reversing
changes made to 80d1601754.
2020-04-18 01:44:43 -05:00
Ali 6c3ae4580f [skip ci] Win64 eqemu_server.pl
Changed binaries to x64 and got rid of wget.exe for windows, switched to
native WebClient
2020-04-17 18:53:35 +03:00
Akkadius 3daf03c796 Remove errant cout [skip ci] 2020-04-11 05:57:31 -05:00
Akkadius 5b4c4bfd66 Implement content flags 2020-04-11 05:48:41 -05:00
Akkadius 47b8aa3f18 Export quest calls 2020-04-11 04:38:42 -05:00
Akkadius 287fc5d313 Create 2020_04_11_expansions_content_filters.sql 2020-04-11 03:13:03 -05:00
Akkadius 77cacf5cd1 Add std::string WorldContentService::GetCurrentExpansionName() [skip ci] 2020-04-11 03:11:09 -05:00
Akkadius e0363a8fe1 Repository tweaks [skip ci] 2020-04-11 02:47:54 -05:00
Akkadius 5c7eb0707f Bulk load goallists 2020-04-11 02:19:58 -05:00
Akkadius 423bb7f0b3 Adjust content bootstrapping in zone [skip ci] 2020-04-11 01:58:35 -05:00
Akkadius 2b1b786f02 Merge branch 'master' of https://github.com/EQEmu/Server into integration/multi-tenancy-expansions-repository 2020-04-06 02:55:46 -05:00
Chris Miles b23bc83f0f Merge pull request #1018 from EQEmu/feature/generated-repositories
Code Generated Repositories
2020-04-06 02:24:43 -05:00
Akkadius 700d062606 Fix windows compile 2020-04-06 01:51:58 -05:00
Akkadius 867ff3dcfa Add constructor to world content service 2020-04-06 00:22:52 -05:00
Akkadius a19bb7b544 Merge branch 'feature/peq-expansions' of https://github.com/EQEmu/Server into feature/generated-repositories 2020-04-05 23:21:21 -05:00
Akkadius 723a3aa18e Update cmake lists [skip ci] 2020-04-05 23:18:32 -05:00
Akkadius be57c57029 More adjustments [skip ci[ 2020-04-05 23:11:25 -05:00
Akkadius 725ad9ddf5 Fix comment formatting [skip ci] 2020-04-05 22:23:29 -05:00
Akkadius c978ca65a4 Split repositories out between a base immutable repository (that does not change) and an extended repository of which developers can add more custom methods to 2020-04-05 22:19:36 -05:00
Akkadius 0cce61e85d Filter GetZoneCFG [skip ci] 2020-04-05 20:11:05 -05:00
Akkadius c8722ea789 Filter start_zones [skip ci] 2020-04-05 19:58:04 -05:00
Akkadius 2f4a217f7a Filter zone_points [skip ci] 2020-04-05 19:49:04 -05:00
Akkadius 9aac84a405 filter traps [skip ci] 2020-04-05 19:45:45 -05:00
Akkadius 91c874a310 Filter starting_items [skip ci] 2020-04-05 19:43:09 -05:00
Akkadius 9fbcd99be2 Filter ground spawns [skip ci] 2020-04-05 19:40:40 -05:00
Akkadius 68a2af1bce Filter forage [skip ci] 2020-04-05 19:37:00 -05:00
Akkadius dadd674b63 Filter fishing [skip ci] 2020-04-05 19:30:02 -05:00
Akkadius f7d4e51da9 Filter global_loot [skip ci] 2020-04-05 19:20:50 -05:00
Akkadius 152d985821 Filter loot tables and drops [skip ci] 2020-04-05 19:01:45 -05:00
Akkadius 6e3922b7cc Filter merchants [skip ci] 2020-04-05 18:50:30 -05:00
Akkadius 9a90bdf91a Filter tradeskills [skip ci] 2020-04-05 18:40:19 -05:00
Akkadius 17e9198a58 Another typo fix [skip ci] 2020-04-04 21:38:05 -05:00
Akkadius e17bd303b8 Fix typos to stop triggering Secrets [skip ci] 2020-04-04 18:00:48 -05:00
Akkadius be8a6b6af4 Add spawn expansion filtering 2020-04-04 06:08:56 -05:00
Akkadius 80baf1b9ed Filter objects by expansion 2020-04-04 05:59:20 -05:00
Akkadius 8a711f3c64 Expansion filtering for doors 2020-04-04 05:51:21 -05:00
Akkadius c1e58673b2 Add expansion gating for zoning 2020-04-04 05:36:18 -05:00
Akkadius fe7e850a04 Return blank string values for string entries that return back null 2020-04-04 04:48:46 -05:00
Akkadius 15c9b64120 Add GetWhere and DeleteWhere repository methods 2020-04-04 04:44:39 -05:00
Akkadius cc8aa354f1 Add string_id define [skip ci] 2020-04-04 04:15:43 -05:00
Akkadius 33bf20a037 Merge branch 'feature/multi-tenancy' of https://github.com/EQEmu/Server into feature/peq-expansions 2020-04-04 03:56:44 -05:00
Akkadius bcef171cf9 Fix for tradeskill query [skip ci] 2020-04-04 03:55:53 -05:00
Akkadius 9faae00d15 Update cmake lists [skip ci] 2020-04-04 02:59:48 -05:00
Akkadius 0552582274 Use double quotes in strings [skip ci] 2020-04-04 02:56:14 -05:00
Akkadius 376c123fa1 More table exclusions [skip ci] 2020-04-04 02:39:15 -05:00
Akkadius 80fb204f39 More repository comb-throughs [skip ci] 2020-04-04 02:34:34 -05:00
Akkadius 826f0418f7 More float fixes [skip ci] 2020-04-04 02:27:27 -05:00
Akkadius a824ddec44 Fix float types, remove some errant table repositories [skip ci] 2020-04-04 02:26:30 -05:00
Akkadius 9e27ffacff Add tables to ignore list that do not follow typical table conventions 2020-04-04 02:13:47 -05:00
Akkadius 3aaa5020b1 Fix repository struct defaults for varchar | text 2020-04-04 02:04:48 -05:00
Akkadius d691db6621 Add repositories to cmakelists [skip ci] 2020-04-03 03:31:38 -05:00
Akkadius 82b017887d Upload generated repositories 2020-04-03 02:49:40 -05:00
Akkadius 494811c04b Update repository-generator.pl 2020-04-03 02:41:44 -05:00
Akkadius cbd2336442 Update repository generator to check for schema [skip ci] 2020-04-03 02:38:37 -05:00
Akkadius 3c9fe45af5 Update repository generator 2020-04-03 01:58:06 -05:00
Akkadius f984bd2faf Update instance list repository with auto generated code 2020-04-03 01:34:54 -05:00
Akkadius fe718a6a1d Create repository.template 2020-04-03 01:34:43 -05:00
Akkadius 9e910ad90a Create repository-generator.pl 2020-04-03 01:34:37 -05:00
Akkadius c0c1b5e678 Move doc parser scripts to new generator folder 2020-04-03 01:34:31 -05:00
Akkadius 94ab6499c8 Create account_repository.h 2020-04-03 01:17:09 -05:00
Akkadius 1650a466a1 Add instance list repository; split repository cmake config 2020-04-02 19:38:26 -05:00
Akkadius 459303c0fe Hide test: command from the help output (Developer testing) [skip ci] 2020-04-02 15:58:37 -05:00
Akkadius 72b1e58edb Groundwork for world content service and content filtering 2020-04-01 06:07:44 -05:00
Akkadius 58534dea16 Some cleanup [skip ci] 2020-04-01 00:57:34 -05:00
Akkadius 7d8347a556 Update world item instance references [skip ci] 2020-03-31 03:28:35 -05:00
Akkadius 3b9016f503 More faction calls [skip ci] 2020-03-31 02:56:48 -05:00
Akkadius 63eca22aac Get factions fully moved over [skip ci] 2020-03-31 02:49:42 -05:00
Akkadius dae20afcba Fix character creation tenancy operations 2020-03-31 01:49:42 -05:00
Akkadius 019735c654 Keeps spawns from doing individual loads and prefer bulk loading [skip ci] 2020-03-30 23:25:32 -05:00
Akkadius 0c3dd7dc93 Update zone.cpp [skip ci] 2020-03-30 21:33:11 -05:00
Akkadius 79dbddd56e Decouple temporary merchant list call [skip ci] 2020-03-30 21:32:59 -05:00
Akkadius 43716332aa Bulk load grids at repop and zone init instead of 2 costly individual selects per NPC, create repositories to decouple database logic from business logic 2020-03-30 05:49:43 -05:00
Akkadius 128cc458fd Separate tradeskill queries to not be cross-boundary, clean up logic 2020-03-30 04:29:52 -05:00
Akkadius e9b361445f Add give item saylinks to #fi #itemsearch 2020-03-30 04:28:54 -05:00
Akkadius 6127baf12a Update schema [skip ci] 2020-03-29 20:16:17 -05:00
Akkadius 8effd671c5 Second pass through tables [skip ci] 2020-03-22 03:27:44 -05:00
Akkadius 06a51f555e Fix some stragglers 2020-03-12 03:15:14 -05:00
Akkadius 3dc227e8cc Update schema [skip ci] 2020-03-12 02:53:19 -05:00
Akkadius 4375e51431 Push up schema notes [skip ci] 2020-03-12 02:42:04 -05:00
Akkadius d360c60289 Migrate ldon traps and #hotfix [skip ci] 2020-03-12 02:40:04 -05:00
Akkadius 951a77716c Migrate NPC spells, emotes, merchantlist [skip ci] 2020-03-12 02:34:02 -05:00
Akkadius ca49f3902f Migrate getZoneX calls and npc types calls [skip ci] 2020-03-12 02:27:09 -05:00
Akkadius b22d8f6148 Migrate objects and pets [skip ci] 2020-03-12 01:47:40 -05:00
Akkadius a37260fec5 Port import and eport client files to use content database connection [skip ci] 2020-03-12 01:32:25 -05:00
Akkadius ea98a71f22 client_files/export main formatting [skip ci] 2020-03-12 01:24:35 -05:00
Akkadius 7ee28d6361 Migrate shared memory to use content database source; add logic in DB::core to prevent double freeing [skip ci] 2020-03-12 01:23:06 -05:00
Akkadius 49d835165c Shared memory formatting main.cpp [skip ci] 2020-03-12 00:01:30 -05:00
Akkadius 286c08b8d5 Migrate spawn tables [skip ci] 2020-03-12 00:00:39 -05:00
Akkadius 9048265283 Migrate horses [skip ci] 2020-03-11 23:29:54 -05:00
Akkadius 4b55438b3a Migrate ground_spawns [skip ci] 2020-03-11 23:29:24 -05:00
Akkadius 26b24c02f1 Simplify connection logic 2020-03-11 04:23:44 -05:00
Akkadius 6af1ae32ae Migrate grids [skip ci] 2020-03-11 04:10:21 -05:00
Akkadius 262432f504 Migrate start_zones [skip ci] 2020-03-11 03:58:30 -05:00
Akkadius 3a09197d77 Migrate zone [skip ci] 2020-03-11 03:55:44 -05:00
Akkadius 8d21225eb3 Migrate veteran_reward_templates [skip ci] 2020-03-11 03:43:16 -05:00
Akkadius 4b2fe732d2 Migrate tributes [skip ci] 2020-03-11 03:41:58 -05:00
Akkadius f5cba5ecab Migrate tradeskills and traps [skip ci] 2020-03-11 03:41:09 -05:00
Akkadius df66c75df2 Migrate global_loot [skip ci] 2020-03-11 03:31:20 -05:00
Akkadius b3e4d90e4f Migrate tasks [skip ci] 2020-03-11 03:31:06 -05:00
Akkadius 0d270fdac7 Migrate forage [skip ci] 2020-03-11 03:30:52 -05:00
Akkadius ed06129f9d Migrate fishing [skip ci] 2020-03-11 03:24:21 -05:00
Akkadius ec5be4985e Migrate factions [skip ci] 2020-03-11 03:22:36 -05:00
Akkadius c98d2743c5 Migrate doors [skip ci] 2020-03-11 03:20:38 -05:00
Akkadius 7c2a3f602c Migrate char_create_combinations [skip ci] 2020-03-11 03:12:53 -05:00
Akkadius 13e8199298 Migrate books [skip ci] 2020-03-11 03:10:40 -05:00
Akkadius 1737ef605c Migrate blocked_spells [skip ci] 2020-03-11 03:09:59 -05:00
Akkadius 8e441f006e Migrate auras [skip ci] 2020-03-11 03:06:40 -05:00
Akkadius 91ca5dcade Migrate alternate_currency [skip ci] 2020-03-11 03:02:41 -05:00
Akkadius 7cf52d467e Migrate adventure database calls [skip ci] 2020-03-11 03:00:08 -05:00
Akkadius dde9b98e4f Beginning of multi-tenancy work 2020-03-11 02:43:21 -05:00
552 changed files with 258369 additions and 7903 deletions
+16
View File
@@ -0,0 +1,16 @@
---
kind: pipeline
type: docker
name: EQEmulator Server Linux CI
# Limits how many of these builds can run on the drone runner at a time, this isn't about cores
concurrency:
limit: 1
steps:
- name: server-build
# Source build script https://github.com/Akkadius/akk-stack/blob/master/containers/eqemu-server/Dockerfile#L20
image: akkadius/eqemu-server:latest
commands:
- sudo chown eqemu:eqemu /drone/src/ * -R
- git submodule init && git submodule update && mkdir -p build && cd build && cmake -DEQEMU_BUILD_LOGIN=ON -DEQEMU_BUILD_BOTS=ON -DEQEMU_BUILD_LUA=ON -G 'Unix Makefiles' .. && make -j$((`nproc`-4))
+22 -13
View File
@@ -6,7 +6,7 @@
{
"label": "make",
"type": "shell",
"command": "cd build && make",
"command": "cd bin && make",
"group": {
"kind": "build",
"isDefault": true
@@ -18,7 +18,7 @@
{
"label": "make clean",
"type": "shell",
"command": "cd build && make clean",
"command": "cd bin && make clean",
"group": {
"kind": "build",
"isDefault": true
@@ -30,7 +30,7 @@
{
"label": "cmake",
"type": "shell",
"command": "mkdir -p build && cd build && rm CMakeCache.txt && cmake -DEQEMU_BUILD_LOGIN=ON -DEQEMU_BUILD_LUA=ON -G 'Unix Makefiles' ..",
"command": "mkdir -p bin && cd bin && rm CMakeCache.txt && cmake -DEQEMU_BUILD_LOGIN=ON -DEQEMU_BUILD_LUA=ON -G 'Unix Makefiles' ..",
"group": {
"kind": "build",
"isDefault": true
@@ -52,7 +52,7 @@
{
"label": "download maps",
"type": "shell",
"command": "mkdir -p build/bin && cd build/bin && wget https://codeload.github.com/Akkadius/EQEmuMaps/zip/master -O maps.zip && unzip -o maps.zip && rm ./maps -rf && mv EQEmuMaps-master maps && rm maps.zip",
"command": "mkdir -p bin && cd bin && wget https://codeload.github.com/Akkadius/EQEmuMaps/zip/master -O maps.zip && unzip -o maps.zip && rm ./maps -rf && mv EQEmuMaps-master maps && rm maps.zip",
"group": {
"kind": "build",
"isDefault": true
@@ -64,7 +64,7 @@
{
"label": "download quests",
"type": "shell",
"command": "mkdir -p build/bin && cd build/bin && cd server && git -C ./quests pull 2> /dev/null || git clone https://github.com/ProjectEQ/projecteqquests.git quests",
"command": "mkdir -p bin && cd bin && cd server && git -C ./quests pull 2> /dev/null || git clone https://github.com/ProjectEQ/projecteqquests.git quests",
"group": {
"kind": "build",
"isDefault": true
@@ -76,7 +76,7 @@
{
"label": "download eqemu_config",
"type": "shell",
"command": "mkdir -p build/bin && cd build/bin && wget --no-check-certificate https://raw.githubusercontent.com/Akkadius/EQEmuInstall/master/eqemu_config_docker.json -O eqemu_config.json",
"command": "mkdir -p bin && cd bin && wget --no-check-certificate https://raw.githubusercontent.com/Akkadius/EQEmuInstall/master/eqemu_config_docker.json -O eqemu_config.json",
"group": {
"kind": "build",
"isDefault": true
@@ -88,7 +88,7 @@
{
"label": "rebuild database (mariadb must be started)",
"type": "shell",
"command": "mkdir -p build/bin && cd build/bin && docker run -i --rm --privileged -v ${HOST_PROJECT_PATH}/build/bin:/src --network=eqemu -it eqemu/server:0.0.3 bash -c './eqemu_server.pl source_peq_db && ./eqemu_server.pl check_db_updates && ./eqemu_server.pl linux_login_server_setup'",
"command": "mkdir -p bin && cd bin && docker run -i --rm --privileged -v ${HOST_PROJECT_PATH}/bin:/src --network=eqemu -it eqemu/server:0.0.3 bash -c './eqemu_server.pl source_peq_db && ./eqemu_server.pl check_db_updates && ./eqemu_server.pl linux_login_server_setup'",
"group": {
"kind": "build",
"isDefault": true
@@ -100,7 +100,7 @@
{
"label": "zone 7000",
"type": "shell",
"command": "docker stop zone7000 | true && docker network create eqemu | true && docker run -i --rm --name zone7000 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/build/bin:/src --ulimit core=10000000 --network=eqemu -p 7000:7000/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./zone dynamic_zone7000:7000",
"command": "docker stop zone7000 | true && docker network create eqemu | true && docker run -i --rm --name zone7000 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 --network=eqemu -p 7000:7000/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./zone dynamic_zone7000:7000",
"group": {
"kind": "test",
"isDefault": true
@@ -109,7 +109,7 @@
{
"label": "zone 7001",
"type": "shell",
"command": "docker stop zone7001 | true && docker network create eqemu | true && docker run -i --rm --name zone7001 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/build/bin:/src --ulimit core=10000000 --network=eqemu -p 7001:7001/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./zone dynamic_zone7001:7001",
"command": "docker stop zone7001 | true && docker network create eqemu | true && docker run -i --rm --name zone7001 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 --network=eqemu -p 7001:7001/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./zone dynamic_zone7001:7001",
"group": {
"kind": "test",
"isDefault": true
@@ -118,7 +118,7 @@
{
"label": "loginserver",
"type": "shell",
"command": "docker stop loginserver | true && docker network create eqemu | true && docker run -i --rm --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/build/bin:/src --ulimit core=10000000 --network=eqemu --name loginserver -p 5999:5999/udp -p 5998:5998/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./loginserver",
"command": "docker stop loginserver | true && docker network create eqemu | true && docker run -i --rm --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 --network=eqemu --name loginserver -p 5999:5999/udp -p 5998:5998/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./loginserver",
"group": {
"kind": "test",
"isDefault": true
@@ -127,7 +127,7 @@
{
"label": "shared_memory, world",
"type": "shell",
"command": "docker stop sharedmemory | true && docker stop world | true && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/build/bin:/src --network=eqemu --name sharedmemory eqemu/server:0.0.3 ./shared_memory && docker run --rm -v ${HOST_PROJECT_PATH}/build/bin:/src --ulimit core=10000000 -e LD_LIBRARY_PATH=/src/ --network=eqemu --name world -p 9000:9000 -p 9000:9000/udp -p 9001:9001 -p 9080:9080 eqemu/server:0.0.3 gdb -ex run ./world",
"command": "docker stop sharedmemory | true && docker stop world | true && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/bin:/src --network=eqemu --name sharedmemory eqemu/server:0.0.3 ./shared_memory && docker run --rm -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 -e LD_LIBRARY_PATH=/src/ --network=eqemu --name world -p 9000:9000 -p 9000:9000/udp -p 9001:9001 -p 9080:9080 eqemu/server:0.0.3 gdb -ex run ./world",
"group": {
"kind": "test",
"isDefault": true
@@ -136,7 +136,7 @@
{
"label": "queryserv",
"type": "shell",
"command": "docker stop queryserv | true && docker run --rm -v ${HOST_PROJECT_PATH}/build/bin:/src --ulimit core=10000000 -e LD_LIBRARY_PATH=/src/ --network=eqemu --name queryserv eqemu/server:0.0.3 gdb -ex run ./queryserv",
"command": "docker stop queryserv | true && docker run --rm -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 -e LD_LIBRARY_PATH=/src/ --network=eqemu --name queryserv eqemu/server:0.0.3 gdb -ex run ./queryserv",
"group": {
"kind": "test",
"isDefault": true
@@ -145,7 +145,16 @@
{
"label": "mariadb",
"type": "shell",
"command": "docker stop mariadb | true && cd build/bin && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/build/bin/db:/bitnami/mariadb -p 3306:3306 -e MARIADB_DATABASE=peq -e MARIADB_USER=eqemu -e MARIADB_PASSWORD=eqemupass -e ALLOW_EMPTY_PASSWORD=yes --name mariadb --network=eqemu bitnami/mariadb:latest",
"command": "docker stop mariadb | true && cd bin && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/bin/db:/bitnami/mariadb -p 3306:3306 -e MARIADB_DATABASE=peq -e MARIADB_USER=eqemu -e MARIADB_PASSWORD=eqemupass -e ALLOW_EMPTY_PASSWORD=yes --name mariadb --network=eqemu bitnami/mariadb:latest",
"group": {
"kind": "test",
"isDefault": true
}
},
{
"label": "ucs",
"type": "shell",
"command": "docker stop ucs | true && cd bin && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/bin:/src -p 7778:7778 --name ucs --network=eqemu eqemu/server:0.0.3 gdb -ex run ./ucs",
"group": {
"kind": "test",
"isDefault": true
+3 -3
View File
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.8)
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH})
@@ -12,7 +12,7 @@ IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_STANDARD 14)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_EXTENSIONS OFF)
@@ -133,7 +133,7 @@ ENDIF(EQEMU_ENABLE_BOTS)
#database
IF(MySQL_FOUND AND MariaDB_FOUND)
SET(DATABASE_LIBRARY_SELECTION MySQL CACHE STRING "Database library to use:
SET(DATABASE_LIBRARY_SELECTION MariaDB CACHE STRING "Database library to use:
MySQL
MariaDB"
)
+6 -1
View File
@@ -17,9 +17,13 @@
|:---:|:---:|:---:|
|**Install Count**|![Windows Install Count](http://analytics.akkadius.com/?install_count&windows_count)|![Linux Install Count](http://analytics.akkadius.com/?install_count&linux_count)|
### > Windows
* [Install](https://eqemu.gitbook.io/server/categories/how-to-guides/installation/server-installation-windows)
* [Install Guide](https://eqemu.gitbook.io/server/categories/installation/server-installation-windows)
### > Debian/Ubuntu/CentOS/Fedora
* [Install Guide](https://eqemu.gitbook.io/server/categories/installation/server-installation-linux)
* You can use curl or wget to kick off the installer (whichever your OS has)
> curl -O https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/linux_installer/install.sh install.sh && chmod 755 install.sh && ./install.sh
@@ -76,3 +80,4 @@ forum, although pull requests will be much quicker and easier on all parties.
<a href="https://github.com/EQEmu/server/graphs/contributors">
<img src="https://contributors-img.firebaseapp.com/image?repo=EQEmu/server" />
</a>
+119 -76
View File
@@ -26,21 +26,24 @@
#include "../../common/crash.h"
#include "../../common/rulesys.h"
#include "../../common/string_util.h"
#include "../../common/content/world_content_service.h"
EQEmuLogSys LogSys;
WorldContentService content_service;
void ExportSpells(SharedDatabase *db);
void ExportSkillCaps(SharedDatabase *db);
void ExportBaseData(SharedDatabase *db);
void ExportDBStrings(SharedDatabase *db);
int main(int argc, char **argv) {
int main(int argc, char **argv)
{
RegisterExecutablePlatform(ExePlatformClientExport);
LogSys.LoadLogSettingsDefaults();
set_exception_handler();
LogInfo("Client Files Export Utility");
if(!EQEmuConfig::LoadConfig()) {
if (!EQEmuConfig::LoadConfig()) {
LogError("Unable to load configuration file");
return 1;
}
@@ -48,14 +51,38 @@ int main(int argc, char **argv) {
auto Config = EQEmuConfig::get();
SharedDatabase database;
SharedDatabase content_db;
LogInfo("Connecting to database");
if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) {
if (!database.Connect(
Config->DatabaseHost.c_str(),
Config->DatabaseUsername.c_str(),
Config->DatabasePassword.c_str(),
Config->DatabaseDB.c_str(),
Config->DatabasePort
)) {
LogError("Unable to connect to the database, cannot continue without a database connection");
return 1;
}
/* Register Log System and Settings */
/**
* Multi-tenancy: Content database
*/
if (!Config->ContentDbHost.empty()) {
if (!content_db.Connect(
Config->ContentDbHost.c_str() ,
Config->ContentDbUsername.c_str(),
Config->ContentDbPassword.c_str(),
Config->ContentDbName.c_str(),
Config->ContentDbPort
)) {
LogError("Cannot continue without a content database connection");
return 1;
}
} else {
content_db.SetMysql(database.getMySQL());
}
database.LoadLogSettings(LogSys.log_settings);
LogSys.StartFileLogs();
@@ -66,15 +93,15 @@ int main(int argc, char **argv) {
}
if (arg_1 == "spells") {
ExportSpells(&database);
ExportSpells(&content_db);
return 0;
}
if (arg_1 == "skills") {
ExportSkillCaps(&database);
ExportSkillCaps(&content_db);
return 0;
}
if (arg_1 == "basedata") {
ExportBaseData(&database);
ExportBaseData(&content_db);
return 0;
}
if (arg_1 == "dbstring") {
@@ -82,9 +109,9 @@ int main(int argc, char **argv) {
return 0;
}
ExportSpells(&database);
ExportSkillCaps(&database);
ExportBaseData(&database);
ExportSpells(&content_db);
ExportSkillCaps(&content_db);
ExportBaseData(&content_db);
ExportDBStrings(&database);
LogSys.CloseFileLogs();
@@ -92,93 +119,105 @@ int main(int argc, char **argv) {
return 0;
}
void ExportSpells(SharedDatabase *db) {
void ExportSpells(SharedDatabase *db)
{
LogInfo("Exporting Spells");
FILE *f = fopen("export/spells_us.txt", "w");
if(!f) {
if (!f) {
LogError("Unable to open export/spells_us.txt to write, skipping.");
return;
}
const std::string query = "SELECT * FROM spells_new ORDER BY id";
auto results = db->QueryDatabase(query);
const std::string query = "SELECT * FROM spells_new ORDER BY id";
auto results = db->QueryDatabase(query);
if(results.Success()) {
for (auto row = results.begin(); row != results.end(); ++row) {
std::string line;
unsigned int fields = results.ColumnCount();
for(unsigned int i = 0; i < fields; ++i) {
if(i != 0) {
if (results.Success()) {
for (auto row = results.begin(); row != results.end(); ++row) {
std::string line;
unsigned int fields = results.ColumnCount();
for (unsigned int i = 0; i < fields; ++i) {
if (i != 0) {
line.push_back('^');
}
if(row[i] != nullptr) {
if (row[i] != nullptr) {
line += row[i];
}
}
fprintf(f, "%s\n", line.c_str());
}
} else {
}
else {
}
fclose(f);
}
bool SkillUsable(SharedDatabase *db, int skill_id, int class_id) {
bool SkillUsable(SharedDatabase *db, int skill_id, int class_id)
{
bool res = false;
std::string query = StringFormat("SELECT max(cap) FROM skill_caps WHERE class=%d AND skillID=%d",
class_id, skill_id);
auto results = db->QueryDatabase(query);
if(!results.Success()) {
return false;
}
std::string query = StringFormat(
"SELECT max(cap) FROM skill_caps WHERE class=%d AND skillID=%d",
class_id, skill_id
);
auto results = db->QueryDatabase(query);
if (!results.Success()) {
return false;
}
if (results.RowCount() == 0)
return false;
if (results.RowCount() == 0) {
return false;
}
auto row = results.begin();
if(row[0] && atoi(row[0]) > 0)
return true;
auto row = results.begin();
if (row[0] && atoi(row[0]) > 0) {
return true;
}
return false;
return false;
}
int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) {
int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level)
{
std::string query = StringFormat("SELECT cap FROM skill_caps WHERE class=%d AND skillID=%d AND level=%d",
class_id, skill_id, level);
auto results = db->QueryDatabase(query);
if (!results.Success()) {
return 0;
}
std::string query = StringFormat(
"SELECT cap FROM skill_caps WHERE class=%d AND skillID=%d AND level=%d",
class_id, skill_id, level
);
auto results = db->QueryDatabase(query);
if (!results.Success()) {
return 0;
}
if (results.RowCount() == 0)
return 0;
if (results.RowCount() == 0) {
return 0;
}
auto row = results.begin();
auto row = results.begin();
return atoi(row[0]);
}
void ExportSkillCaps(SharedDatabase *db) {
void ExportSkillCaps(SharedDatabase *db)
{
LogInfo("Exporting Skill Caps");
FILE *f = fopen("export/SkillCaps.txt", "w");
if(!f) {
if (!f) {
LogError("Unable to open export/SkillCaps.txt to write, skipping.");
return;
}
for(int cl = 1; cl <= 16; ++cl) {
for(int skill = 0; skill <= 77; ++skill) {
if(SkillUsable(db, skill, cl)) {
int previous_cap = 0;
for(int level = 1; level <= 100; ++level) {
for (int cl = 1; cl <= 16; ++cl) {
for (int skill = 0; skill <= 77; ++skill) {
if (SkillUsable(db, skill, cl)) {
int previous_cap = 0;
for (int level = 1; level <= 100; ++level) {
int cap = GetSkill(db, skill, cl, level);
if(cap < previous_cap) {
if (cap < previous_cap) {
cap = previous_cap;
}
@@ -192,26 +231,28 @@ void ExportSkillCaps(SharedDatabase *db) {
fclose(f);
}
void ExportBaseData(SharedDatabase *db) {
void ExportBaseData(SharedDatabase *db)
{
LogInfo("Exporting Base Data");
FILE *f = fopen("export/BaseData.txt", "w");
if(!f) {
if (!f) {
LogError("Unable to open export/BaseData.txt to write, skipping.");
return;
}
const std::string query = "SELECT * FROM base_data ORDER BY level, class";
auto results = db->QueryDatabase(query);
if(results.Success()) {
for (auto row = results.begin();row != results.end();++row) {
std::string line;
unsigned int fields = results.ColumnCount();
for(unsigned int rowIndex = 0; rowIndex < fields; ++rowIndex) {
if(rowIndex != 0)
const std::string query = "SELECT * FROM base_data ORDER BY level, class";
auto results = db->QueryDatabase(query);
if (results.Success()) {
for (auto row = results.begin(); row != results.end(); ++row) {
std::string line;
unsigned int fields = results.ColumnCount();
for (unsigned int rowIndex = 0; rowIndex < fields; ++rowIndex) {
if (rowIndex != 0) {
line.push_back('^');
}
if(row[rowIndex] != nullptr) {
if (row[rowIndex] != nullptr) {
line += row[rowIndex];
}
}
@@ -223,27 +264,29 @@ void ExportBaseData(SharedDatabase *db) {
fclose(f);
}
void ExportDBStrings(SharedDatabase *db) {
void ExportDBStrings(SharedDatabase *db)
{
LogInfo("Exporting DB Strings");
FILE *f = fopen("export/dbstr_us.txt", "w");
if(!f) {
if (!f) {
LogError("Unable to open export/dbstr_us.txt to write, skipping.");
return;
}
fprintf(f, "Major^Minor^String(New)\n");
const std::string query = "SELECT * FROM db_str ORDER BY id, type";
auto results = db->QueryDatabase(query);
if(results.Success()) {
for(auto row = results.begin(); row != results.end(); ++row) {
std::string line;
unsigned int fields = results.ColumnCount();
for(unsigned int rowIndex = 0; rowIndex < fields; ++rowIndex) {
if(rowIndex != 0)
const std::string query = "SELECT * FROM db_str ORDER BY id, type";
auto results = db->QueryDatabase(query);
if (results.Success()) {
for (auto row = results.begin(); row != results.end(); ++row) {
std::string line;
unsigned int fields = results.ColumnCount();
for (unsigned int rowIndex = 0; rowIndex < fields; ++rowIndex) {
if (rowIndex != 0) {
line.push_back('^');
}
if(row[rowIndex] != nullptr) {
if (row[rowIndex] != nullptr) {
line += row[rowIndex];
}
}
+36 -10
View File
@@ -24,8 +24,10 @@
#include "../../common/crash.h"
#include "../../common/rulesys.h"
#include "../../common/string_util.h"
#include "../../common/content/world_content_service.h"
EQEmuLogSys LogSys;
WorldContentService content_service;
void ImportSpells(SharedDatabase *db);
void ImportSkillCaps(SharedDatabase *db);
@@ -46,24 +48,48 @@ int main(int argc, char **argv) {
auto Config = EQEmuConfig::get();
SharedDatabase database;
SharedDatabase content_db;
LogInfo("Connecting to database");
if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) {
LogError("Unable to connect to the database, cannot continue without a "
"database connection");
if (!database.Connect(
Config->DatabaseHost.c_str(),
Config->DatabaseUsername.c_str(),
Config->DatabasePassword.c_str(),
Config->DatabaseDB.c_str(),
Config->DatabasePort
)) {
LogError("Unable to connect to the database, cannot continue without a database connection");
return 1;
}
/**
* Multi-tenancy: Content database
*/
if (!Config->ContentDbHost.empty()) {
if (!content_db.Connect(
Config->ContentDbHost.c_str() ,
Config->ContentDbUsername.c_str(),
Config->ContentDbPassword.c_str(),
Config->ContentDbName.c_str(),
Config->ContentDbPort
)) {
LogError("Cannot continue without a content database connection");
return 1;
}
} else {
content_db.SetMysql(database.getMySQL());
}
database.LoadLogSettings(LogSys.log_settings);
LogSys.StartFileLogs();
ImportSpells(&database);
ImportSkillCaps(&database);
ImportBaseData(&database);
ImportSpells(&content_db);
ImportSkillCaps(&content_db);
ImportBaseData(&content_db);
ImportDBStrings(&database);
LogSys.CloseFileLogs();
return 0;
}
@@ -300,10 +326,10 @@ void ImportDBStrings(SharedDatabase *db) {
std::string sql;
int id, type;
std::string value;
id = atoi(split[0].c_str());
type = atoi(split[1].c_str());
if(split.size() >= 3) {
value = ::EscapeString(split[2]);
}
+328 -1
View File
@@ -6,6 +6,7 @@ SET(common_sources
cli/eqemu_command_handler.cpp
compression.cpp
condition.cpp
content/world_content_service.cpp
crash.cpp
crc16.cpp
crc32.cpp
@@ -108,6 +109,331 @@ SET(common_sources
util/directory.cpp
util/uuid.cpp)
SET(repositories
# Criteria
repositories/criteria/content_filter_criteria.h
# Base Repositories
repositories/base/base_aa_ability_repository.h
repositories/base/base_aa_ranks_repository.h
repositories/base/base_aa_rank_effects_repository.h
repositories/base/base_aa_rank_prereqs_repository.h
repositories/base/base_account_repository.h
repositories/base/base_account_flags_repository.h
repositories/base/base_account_ip_repository.h
repositories/base/base_account_rewards_repository.h
repositories/base/base_adventure_details_repository.h
repositories/base/base_adventure_members_repository.h
repositories/base/base_adventure_stats_repository.h
repositories/base/base_adventure_template_repository.h
repositories/base/base_adventure_template_entry_repository.h
repositories/base/base_adventure_template_entry_flavor_repository.h
repositories/base/base_alternate_currency_repository.h
repositories/base/base_auras_repository.h
repositories/base/base_base_data_repository.h
repositories/base/base_blocked_spells_repository.h
repositories/base/base_bugs_repository.h
repositories/base/base_bug_reports_repository.h
repositories/base/base_buyer_repository.h
repositories/base/base_character_activities_repository.h
repositories/base/base_character_alternate_abilities_repository.h
repositories/base/base_character_alt_currency_repository.h
repositories/base/base_character_auras_repository.h
repositories/base/base_character_bandolier_repository.h
repositories/base/base_character_bind_repository.h
repositories/base/base_character_buffs_repository.h
repositories/base/base_character_corpses_repository.h
repositories/base/base_character_corpse_items_repository.h
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_inspect_messages_repository.h
repositories/base/base_character_item_recast_repository.h
repositories/base/base_character_languages_repository.h
repositories/base/base_character_leadership_abilities_repository.h
repositories/base/base_character_material_repository.h
repositories/base/base_character_memmed_spells_repository.h
repositories/base/base_character_pet_buffs_repository.h
repositories/base/base_character_pet_info_repository.h
repositories/base/base_character_pet_inventory_repository.h
repositories/base/base_character_potionbelt_repository.h
repositories/base/base_character_skills_repository.h
repositories/base/base_character_spells_repository.h
repositories/base/base_character_tasks_repository.h
repositories/base/base_char_create_combinations_repository.h
repositories/base/base_char_create_point_allocations_repository.h
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_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_eventlog_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
repositories/base/base_faction_values_repository.h
repositories/base/base_fishing_repository.h
repositories/base/base_forage_repository.h
repositories/base/base_friends_repository.h
repositories/base/base_global_loot_repository.h
repositories/base/base_gm_ips_repository.h
repositories/base/base_goallists_repository.h
repositories/base/base_graveyard_repository.h
repositories/base/base_grid_repository.h
repositories/base/base_grid_entries_repository.h
repositories/base/base_ground_spawns_repository.h
repositories/base/base_group_id_repository.h
repositories/base/base_group_leaders_repository.h
repositories/base/base_guilds_repository.h
repositories/base/base_guild_members_repository.h
repositories/base/base_guild_ranks_repository.h
repositories/base/base_guild_relations_repository.h
repositories/base/base_hackers_repository.h
repositories/base/base_instance_list_repository.h
repositories/base/base_instance_list_player_repository.h
repositories/base/base_inventory_repository.h
repositories/base/base_inventory_snapshots_repository.h
repositories/base/base_ip_exemptions_repository.h
repositories/base/base_items_repository.h
repositories/base/base_item_tick_repository.h
repositories/base/base_ldon_trap_entries_repository.h
repositories/base/base_ldon_trap_templates_repository.h
repositories/base/base_level_exp_mods_repository.h
repositories/base/base_lfguild_repository.h
repositories/base/base_login_accounts_repository.h
repositories/base/base_login_api_tokens_repository.h
repositories/base/base_login_server_admins_repository.h
repositories/base/base_login_server_list_types_repository.h
repositories/base/base_login_world_servers_repository.h
repositories/base/base_logsys_categories_repository.h
repositories/base/base_lootdrop_repository.h
repositories/base/base_lootdrop_entries_repository.h
repositories/base/base_loottable_repository.h
repositories/base/base_loottable_entries_repository.h
repositories/base/base_mail_repository.h
repositories/base/base_merchantlist_repository.h
repositories/base/base_merchantlist_temp_repository.h
repositories/base/base_name_filter_repository.h
repositories/base/base_npc_emotes_repository.h
repositories/base/base_npc_faction_repository.h
repositories/base/base_npc_faction_entries_repository.h
repositories/base/base_npc_scale_global_base_repository.h
repositories/base/base_npc_spells_repository.h
repositories/base/base_npc_spells_effects_repository.h
repositories/base/base_npc_spells_effects_entries_repository.h
repositories/base/base_npc_spells_entries_repository.h
repositories/base/base_npc_types_repository.h
repositories/base/base_npc_types_tint_repository.h
repositories/base/base_object_repository.h
repositories/base/base_object_contents_repository.h
repositories/base/base_perl_event_export_settings_repository.h
repositories/base/base_petitions_repository.h
repositories/base/base_pets_repository.h
repositories/base/base_pets_equipmentset_repository.h
repositories/base/base_pets_equipmentset_entries_repository.h
repositories/base/base_player_titlesets_repository.h
repositories/base/base_proximities_repository.h
repositories/base/base_quest_globals_repository.h
repositories/base/base_raid_details_repository.h
repositories/base/base_raid_members_repository.h
repositories/base/base_reports_repository.h
repositories/base/base_respawn_times_repository.h
repositories/base/base_rule_sets_repository.h
repositories/base/base_rule_values_repository.h
repositories/base/base_saylink_repository.h
repositories/base/base_skill_caps_repository.h
repositories/base/base_spawn2_repository.h
repositories/base/base_spawnentry_repository.h
repositories/base/base_spawngroup_repository.h
repositories/base/base_spawn_conditions_repository.h
repositories/base/base_spawn_condition_values_repository.h
repositories/base/base_spawn_events_repository.h
repositories/base/base_spells_new_repository.h
repositories/base/base_spell_buckets_repository.h
repositories/base/base_spell_globals_repository.h
repositories/base/base_starting_items_repository.h
repositories/base/base_start_zones_repository.h
repositories/base/base_tasks_repository.h
repositories/base/base_tasksets_repository.h
repositories/base/base_task_activities_repository.h
repositories/base/base_timers_repository.h
repositories/base/base_titles_repository.h
repositories/base/base_trader_repository.h
repositories/base/base_tradeskill_recipe_repository.h
repositories/base/base_tradeskill_recipe_entries_repository.h
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
# Extended Repositories
repositories/aa_ability_repository.h
repositories/aa_ranks_repository.h
repositories/aa_rank_effects_repository.h
repositories/aa_rank_prereqs_repository.h
repositories/account_repository.h
repositories/account_flags_repository.h
repositories/account_ip_repository.h
repositories/account_rewards_repository.h
repositories/adventure_details_repository.h
repositories/adventure_members_repository.h
repositories/adventure_stats_repository.h
repositories/adventure_template_repository.h
repositories/adventure_template_entry_repository.h
repositories/adventure_template_entry_flavor_repository.h
repositories/alternate_currency_repository.h
repositories/auras_repository.h
repositories/base_data_repository.h
repositories/blocked_spells_repository.h
repositories/bugs_repository.h
repositories/bug_reports_repository.h
repositories/buyer_repository.h
repositories/character_activities_repository.h
repositories/character_alternate_abilities_repository.h
repositories/character_alt_currency_repository.h
repositories/character_auras_repository.h
repositories/character_bandolier_repository.h
repositories/character_bind_repository.h
repositories/character_buffs_repository.h
repositories/character_corpses_repository.h
repositories/character_corpse_items_repository.h
repositories/character_currency_repository.h
repositories/character_data_repository.h
repositories/character_disciplines_repository.h
repositories/character_inspect_messages_repository.h
repositories/character_item_recast_repository.h
repositories/character_languages_repository.h
repositories/character_leadership_abilities_repository.h
repositories/character_material_repository.h
repositories/character_memmed_spells_repository.h
repositories/character_pet_buffs_repository.h
repositories/character_pet_info_repository.h
repositories/character_pet_inventory_repository.h
repositories/character_potionbelt_repository.h
repositories/character_skills_repository.h
repositories/character_spells_repository.h
repositories/character_tasks_repository.h
repositories/char_create_combinations_repository.h
repositories/char_create_point_allocations_repository.h
repositories/char_recipe_list_repository.h
repositories/completed_tasks_repository.h
repositories/content_flags_repository.h
repositories/data_buckets_repository.h
repositories/db_str_repository.h
repositories/discovered_items_repository.h
repositories/doors_repository.h
repositories/eventlog_repository.h
repositories/faction_base_data_repository.h
repositories/faction_list_repository.h
repositories/faction_list_mod_repository.h
repositories/faction_values_repository.h
repositories/fishing_repository.h
repositories/forage_repository.h
repositories/friends_repository.h
repositories/global_loot_repository.h
repositories/gm_ips_repository.h
repositories/goallists_repository.h
repositories/graveyard_repository.h
repositories/grid_repository.h
repositories/grid_entries_repository.h
repositories/ground_spawns_repository.h
repositories/group_id_repository.h
repositories/group_leaders_repository.h
repositories/guilds_repository.h
repositories/guild_members_repository.h
repositories/guild_ranks_repository.h
repositories/guild_relations_repository.h
repositories/hackers_repository.h
repositories/instance_list_repository.h
repositories/instance_list_player_repository.h
repositories/inventory_repository.h
repositories/inventory_snapshots_repository.h
repositories/ip_exemptions_repository.h
repositories/items_repository.h
repositories/item_tick_repository.h
repositories/ldon_trap_entries_repository.h
repositories/ldon_trap_templates_repository.h
repositories/level_exp_mods_repository.h
repositories/lfguild_repository.h
repositories/login_accounts_repository.h
repositories/login_api_tokens_repository.h
repositories/login_server_admins_repository.h
repositories/login_server_list_types_repository.h
repositories/login_world_servers_repository.h
repositories/logsys_categories_repository.h
repositories/lootdrop_repository.h
repositories/lootdrop_entries_repository.h
repositories/loottable_repository.h
repositories/loottable_entries_repository.h
repositories/mail_repository.h
repositories/merchantlist_repository.h
repositories/merchantlist_temp_repository.h
repositories/name_filter_repository.h
repositories/npc_emotes_repository.h
repositories/npc_faction_repository.h
repositories/npc_faction_entries_repository.h
repositories/npc_scale_global_base_repository.h
repositories/npc_spells_repository.h
repositories/npc_spells_effects_repository.h
repositories/npc_spells_effects_entries_repository.h
repositories/npc_spells_entries_repository.h
repositories/npc_types_repository.h
repositories/npc_types_tint_repository.h
repositories/object_repository.h
repositories/object_contents_repository.h
repositories/perl_event_export_settings_repository.h
repositories/petitions_repository.h
repositories/pets_repository.h
repositories/pets_equipmentset_repository.h
repositories/pets_equipmentset_entries_repository.h
repositories/player_titlesets_repository.h
repositories/proximities_repository.h
repositories/quest_globals_repository.h
repositories/raid_details_repository.h
repositories/raid_members_repository.h
repositories/reports_repository.h
repositories/respawn_times_repository.h
repositories/rule_sets_repository.h
repositories/rule_values_repository.h
repositories/saylink_repository.h
repositories/skill_caps_repository.h
repositories/spawn2_repository.h
repositories/spawnentry_repository.h
repositories/spawngroup_repository.h
repositories/spawn_conditions_repository.h
repositories/spawn_condition_values_repository.h
repositories/spawn_events_repository.h
repositories/spells_new_repository.h
repositories/spell_buckets_repository.h
repositories/spell_globals_repository.h
repositories/starting_items_repository.h
repositories/start_zones_repository.h
repositories/tasks_repository.h
repositories/tasksets_repository.h
repositories/task_activities_repository.h
repositories/timers_repository.h
repositories/titles_repository.h
repositories/trader_repository.h
repositories/tradeskill_recipe_repository.h
repositories/tradeskill_recipe_entries_repository.h
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
# Non-Comformative
repositories/character_recipe_list_repository.h
)
SET(common_headers
any.h
base_packet.h
@@ -116,6 +442,7 @@ SET(common_headers
classes.h
compression.h
condition.h
content/world_content_service.h
crash.h
crc16.h
crc32.h
@@ -380,7 +707,7 @@ SOURCE_GROUP(Util FILES
INCLUDE_DIRECTORIES(Patches SocketLib StackWalker)
ADD_LIBRARY(common ${common_sources} ${common_headers})
ADD_LIBRARY(common ${common_sources} ${common_headers} ${repositories})
IF(UNIX)
SET_SOURCE_FILES_PROPERTIES("SocketLib/Mime.cpp" PROPERTY COMPILE_FLAGS -Wno-unused-result)
+14
View File
@@ -378,6 +378,8 @@ const char *GetClassIDName(uint8 class_id, uint8 level)
return "Berserker Guildmaster";
case MERCHANT:
return "Merchant";
case DISCORD_MERCHANT:
return "Discord Merchant";
case ADVENTURERECRUITER:
return "Adventure Recruiter";
case ADVENTUREMERCHANT:
@@ -388,6 +390,18 @@ const char *GetClassIDName(uint8 class_id, uint8 level)
return "Tribute Master";
case GUILD_TRIBUTE_MASTER:
return "Guild Tribute Master";
case GUILD_BANKER:
return "Guild Banker";
case NORRATHS_KEEPERS_MERCHANT:
return "Radiant Crystal Merchant";
case DARK_REIGN_MERCHANT:
return "Ebon Crystal Merchant";
case FELLOWSHIP_MASTER:
return "Fellowship Master";
case ALT_CURRENCY_MERCHANT:
return "Alternate Currency Merchant";
case MERCERNARY_MASTER:
return "Mercenary Liaison";
default:
return "Unknown";
}
+1
View File
@@ -61,6 +61,7 @@
#define CORPSE_CLASS 62 // only seen on Danvi's Corpse in Akheva so far..
#define TRIBUTE_MASTER 63
#define GUILD_TRIBUTE_MASTER 64 // not sure
#define GUILD_BANKER 66
#define NORRATHS_KEEPERS_MERCHANT 67
#define DARK_REIGN_MERCHANT 68
#define FELLOWSHIP_MASTER 69
+9 -4
View File
@@ -77,7 +77,7 @@ namespace EQEmuCommand {
index++;
}
if (!arguments_filled || argc == 2) {
if (!arguments_filled || argc == 2 || cmd[{"-h", "--help"}]) {
std::string arguments_string;
for (auto &arg : arguments) {
arguments_string += " " + arg;
@@ -101,7 +101,7 @@ namespace EQEmuCommand {
std::cout << command_string.str() << std::endl;
exit(1);
exit(0);
}
}
@@ -168,6 +168,11 @@ namespace EQEmuCommand {
* Print section header
*/
std::string command_prefix = it.first.substr(0, it.first.find(":"));
if (command_prefix.find("test") != std::string::npos) {
continue;
}
if (command_section != command_prefix) {
command_section = command_prefix;
std::cout << termcolor::reset << command_prefix << std::endl;
@@ -183,11 +188,11 @@ namespace EQEmuCommand {
std::cout << std::endl;
std::exit(1);
std::exit(0);
}
if (ran_command) {
std::exit(1);
std::exit(0);
}
}
+101
View File
@@ -0,0 +1,101 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2019 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "world_content_service.h"
#include "../database.h"
#include "../rulesys.h"
#include "../eqemu_logsys.h"
WorldContentService::WorldContentService()
{
SetCurrentExpansion(Expansion::EXPANSION_ALL);
}
int WorldContentService::GetCurrentExpansion() const
{
return current_expansion;
}
void WorldContentService::SetExpansionContext()
{
int expansion = RuleI(Expansion, CurrentExpansion);
if (expansion >= Expansion::Classic && expansion <= Expansion::MaxId) {
content_service.SetCurrentExpansion(expansion);
}
LogInfo(
"Current expansion is [{}] ({})",
GetCurrentExpansion(),
GetCurrentExpansionName()
);
}
std::string WorldContentService::GetCurrentExpansionName()
{
if (content_service.GetCurrentExpansion() == Expansion::EXPANSION_ALL) {
return "All Expansions";
}
if (current_expansion >= Expansion::Classic && current_expansion <= Expansion::MaxId) {
return Expansion::ExpansionName[content_service.GetCurrentExpansion()];
}
return "Unknown Expansion";
}
/**
* @param current_expansion
*/
void WorldContentService::SetCurrentExpansion(int current_expansion)
{
WorldContentService::current_expansion = current_expansion;
}
/**
* @return
*/
const std::vector<std::string> &WorldContentService::GetContentFlags() const
{
return content_flags;
}
/**
* @param content_flags
*/
void WorldContentService::SetContentFlags(std::vector<std::string> content_flags)
{
WorldContentService::content_flags = content_flags;
}
/**
* @param content_flag
* @return
*/
bool WorldContentService::IsContentFlagEnabled(const std::string& content_flag)
{
for (auto &flag : GetContentFlags()) {
if (flag == content_flag) {
return true;
}
}
return false;
}
+173
View File
@@ -0,0 +1,173 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2019 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_WORLD_CONTENT_SERVICE_H
#define EQEMU_WORLD_CONTENT_SERVICE_H
#include <string>
#include <vector>
namespace Expansion {
static const int EXPANSION_ALL = -1;
static const int EXPANSION_FILTER_MAX = 99;
enum ExpansionNumber {
Classic = 0,
TheRuinsOfKunark,
TheScarsOfVelious,
TheShadowsOfLuclin,
ThePlanesOfPower,
TheLegacyOfYkesha,
LostDungeonsOfNorrath,
GatesOfDiscord,
OmensOfWar,
DragonsOfNorrath,
DepthsOfDarkhollow,
ProphecyOfRo,
TheSerpentsSpine,
TheBuriedSea,
SecretsOfFaydwer,
SeedsOfDestruction,
Underfoot,
HouseOfThule,
VeilOfAlaris,
RainOfFear,
CallOfTheForsaken,
TheDarkendSea,
TheBrokenMirror,
EmpiresOfKunark,
RingOfScale,
TheBurningLands,
TormentOfVelious,
MaxId
};
/**
* If you add to this, make sure you update LogCategory
*/
static const char *ExpansionName[ExpansionNumber::MaxId] = {
"Classic",
"The Ruins of Kunark",
"The Scars of Velious",
"The Shadows of Luclin",
"The Planes of Power",
"The Legacy of Ykesha",
"Lost Dungeons of Norrath",
"Gates of Discord",
"Omens of War",
"Dragons of Norrath",
"Depths of Darkhollow",
"Prophecy of Ro",
"The Serpent's Spine",
"The Buried Sea",
"Secrets of Faydwer",
"Seeds of Destruction",
"Underfoot",
"House of Thule",
"Veil of Alaris",
"Rain of Fear",
"Call of the Forsaken",
"The Darkened Sea",
"The Broken Mirror",
"Empires of Kunark",
"Ring of Scale",
"The Burning Lands",
"Torment of Velious",
};
}
class WorldContentService {
public:
WorldContentService();
std::string GetCurrentExpansionName();
int GetCurrentExpansion() const;
void SetCurrentExpansion(int current_expansion);
bool IsClassicEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::Classic || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheRuinsOfKunarkEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheRuinsOfKunark || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheScarsOfVeliousEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheScarsOfVelious || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheShadowsOfLuclinEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheShadowsOfLuclin || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsThePlanesOfPowerEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::ThePlanesOfPower || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheLegacyOfYkeshaEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheLegacyOfYkesha || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsLostDungeonsOfNorrathEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::LostDungeonsOfNorrath || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsGatesOfDiscordEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::GatesOfDiscord || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsOmensOfWarEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::OmensOfWar || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsDragonsOfNorrathEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::DragonsOfNorrath || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsDepthsOfDarkhollowEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::DepthsOfDarkhollow || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsProphecyOfRoEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::ProphecyOfRo || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheSerpentsSpineEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheSerpentsSpine || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheBuriedSeaEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheBuriedSea || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsSecretsOfFaydwerEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::SecretsOfFaydwer || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsSeedsOfDestructionEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::SeedsOfDestruction || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsUnderfootEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::Underfoot || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsHouseOfThuleEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::HouseOfThule || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsVeilOfAlarisEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::VeilOfAlaris || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsRainOfFearEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::RainOfFear || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsCallOfTheForsakenEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::CallOfTheForsaken || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheDarkendSeaEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheDarkendSea || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheBrokenMirrorEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheBrokenMirror || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsEmpiresOfKunarkEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::EmpiresOfKunark || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsRingOfScaleEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::RingOfScale || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheBurningLandsEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheBurningLands || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTormentOfVeliousEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TormentOfVelious || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsCurrentExpansionClassic() { return current_expansion == Expansion::ExpansionNumber::Classic; }
bool IsCurrentExpansionTheRuinsOfKunark() { return current_expansion == Expansion::ExpansionNumber::TheRuinsOfKunark; }
bool IsCurrentExpansionTheScarsOfVelious() { return current_expansion == Expansion::ExpansionNumber::TheScarsOfVelious; }
bool IsCurrentExpansionTheShadowsOfLuclin() { return current_expansion == Expansion::ExpansionNumber::TheShadowsOfLuclin; }
bool IsCurrentExpansionThePlanesOfPower() { return current_expansion == Expansion::ExpansionNumber::ThePlanesOfPower; }
bool IsCurrentExpansionTheLegacyOfYkesha() { return current_expansion == Expansion::ExpansionNumber::TheLegacyOfYkesha; }
bool IsCurrentExpansionLostDungeonsOfNorrath() { return current_expansion == Expansion::ExpansionNumber::LostDungeonsOfNorrath; }
bool IsCurrentExpansionGatesOfDiscord() { return current_expansion == Expansion::ExpansionNumber::GatesOfDiscord; }
bool IsCurrentExpansionOmensOfWar() { return current_expansion == Expansion::ExpansionNumber::OmensOfWar; }
bool IsCurrentExpansionDragonsOfNorrath() { return current_expansion == Expansion::ExpansionNumber::DragonsOfNorrath; }
bool IsCurrentExpansionDepthsOfDarkhollow() { return current_expansion == Expansion::ExpansionNumber::DepthsOfDarkhollow; }
bool IsCurrentExpansionProphecyOfRo() { return current_expansion == Expansion::ExpansionNumber::ProphecyOfRo; }
bool IsCurrentExpansionTheSerpentsSpine() { return current_expansion == Expansion::ExpansionNumber::TheSerpentsSpine; }
bool IsCurrentExpansionTheBuriedSea() { return current_expansion == Expansion::ExpansionNumber::TheBuriedSea; }
bool IsCurrentExpansionSecretsOfFaydwer() { return current_expansion == Expansion::ExpansionNumber::SecretsOfFaydwer; }
bool IsCurrentExpansionSeedsOfDestruction() { return current_expansion == Expansion::ExpansionNumber::SeedsOfDestruction; }
bool IsCurrentExpansionUnderfoot() { return current_expansion == Expansion::ExpansionNumber::Underfoot; }
bool IsCurrentExpansionHouseOfThule() { return current_expansion == Expansion::ExpansionNumber::HouseOfThule; }
bool IsCurrentExpansionVeilOfAlaris() { return current_expansion == Expansion::ExpansionNumber::VeilOfAlaris; }
bool IsCurrentExpansionRainOfFear() { return current_expansion == Expansion::ExpansionNumber::RainOfFear; }
bool IsCurrentExpansionCallOfTheForsaken() { return current_expansion == Expansion::ExpansionNumber::CallOfTheForsaken; }
bool IsCurrentExpansionTheDarkendSea() { return current_expansion == Expansion::ExpansionNumber::TheDarkendSea; }
bool IsCurrentExpansionTheBrokenMirror() { return current_expansion == Expansion::ExpansionNumber::TheBrokenMirror; }
bool IsCurrentExpansionEmpiresOfKunark() { return current_expansion == Expansion::ExpansionNumber::EmpiresOfKunark; }
bool IsCurrentExpansionRingOfScale() { return current_expansion == Expansion::ExpansionNumber::RingOfScale; }
bool IsCurrentExpansionTheBurningLands() { return current_expansion == Expansion::ExpansionNumber::TheBurningLands; }
bool IsCurrentExpansionTormentOfVelious() { return current_expansion == Expansion::ExpansionNumber::TormentOfVelious; }
private:
int current_expansion{};
std::vector<std::string> content_flags;
public:
const std::vector<std::string> &GetContentFlags() const;
bool IsContentFlagEnabled(const std::string& content_flag);
void SetContentFlags(std::vector<std::string> content_flags);
void SetExpansionContext();
};
extern WorldContentService content_service;
#endif //EQEMU_WORLD_CONTENT_SERVICE_H
+243 -202
View File
@@ -61,15 +61,15 @@ Database::Database(const char* host, const char* user, const char* passwd, const
Connect(host, user, passwd, database, port);
}
bool Database::Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port) {
bool Database::Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port, std::string connection_label) {
uint32 errnum= 0;
char errbuf[MYSQL_ERRMSG_SIZE];
if (!Open(host, user, passwd, database, port, &errnum, errbuf)) {
LogError("Failed to connect to database: Error: {}", errbuf);
LogError("[MySQL] Connection [{}] Failed to connect to database: Error [{}]", connection_label, errbuf);
return false;
}
else {
LogInfo("Using database [{}] at [{}]:[{}]", database, host,port);
LogInfo("[MySQL] Connection [{}] database [{}] at [{}]:[{}]", connection_label, database, host,port);
return true;
}
}
@@ -339,7 +339,7 @@ bool Database::ReserveName(uint32 account_id, char* name) {
query = StringFormat("INSERT INTO `character_data` SET `account_id` = %i, `name` = '%s'", account_id, name);
results = QueryDatabase(query);
if (!results.Success() || results.ErrorMessage() != ""){ return false; }
// Put character into the default guild if rule is being used.
int guild_id = RuleI(Character, DefaultGuild);
@@ -353,7 +353,7 @@ bool Database::ReserveName(uint32 account_id, char* name) {
}
}
}
return true;
}
@@ -512,96 +512,96 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
"guild_auto_consent,"
"RestTimer) "
"VALUES ("
"%u," // id
"%u," // account_id
"'%s'," // `name`
"'%s'," // last_name
"%u," // gender
"%u," // race
"%u," // class
"%u," // `level`
"%u," // deity
"%u," // birthday
"%u," // last_login
"%u," // time_played
"%u," // pvp_status
"%u," // level2
"%u," // anon
"%u," // gm
"%u," // intoxication
"%u," // hair_color
"%u," // beard_color
"%u," // eye_color_1
"%u," // eye_color_2
"%u," // hair_style
"%u," // beard
"%u," // ability_time_seconds
"%u," // ability_number
"%u," // ability_time_minutes
"%u," // ability_time_hours
"'%s'," // title
"'%s'," // suffix
"%u," // exp
"%u," // points
"%u," // mana
"%u," // cur_hp
"%u," // str
"%u," // sta
"%u," // cha
"%u," // dex
"%u," // `int`
"%u," // agi
"%u," // wis
"%u," // face
"%f," // y
"%f," // x
"%f," // z
"%f," // heading
"%u," // pvp2
"%u," // pvp_type
"%u," // autosplit_enabled
"%u," // zone_change_count
"%u," // drakkin_heritage
"%u," // drakkin_tattoo
"%u," // drakkin_details
"%i," // toxicity
"%i," // hunger_level
"%i," // thirst_level
"%u," // ability_up
"%u," // zone_id
"%u," // zone_instance
"%u," // leadership_exp_on
"%u," // ldon_points_guk
"%u," // ldon_points_mir
"%u," // ldon_points_mmc
"%u," // ldon_points_ruj
"%u," // ldon_points_tak
"%u," // ldon_points_available
"%u," // id
"%u," // account_id
"'%s'," // `name`
"'%s'," // last_name
"%u," // gender
"%u," // race
"%u," // class
"%u," // `level`
"%u," // deity
"%u," // birthday
"%u," // last_login
"%u," // time_played
"%u," // pvp_status
"%u," // level2
"%u," // anon
"%u," // gm
"%u," // intoxication
"%u," // hair_color
"%u," // beard_color
"%u," // eye_color_1
"%u," // eye_color_2
"%u," // hair_style
"%u," // beard
"%u," // ability_time_seconds
"%u," // ability_number
"%u," // ability_time_minutes
"%u," // ability_time_hours
"'%s'," // title
"'%s'," // suffix
"%u," // exp
"%u," // points
"%u," // mana
"%u," // cur_hp
"%u," // str
"%u," // sta
"%u," // cha
"%u," // dex
"%u," // `int`
"%u," // agi
"%u," // wis
"%u," // face
"%f," // y
"%f," // x
"%f," // z
"%f," // heading
"%u," // pvp2
"%u," // pvp_type
"%u," // autosplit_enabled
"%u," // zone_change_count
"%u," // drakkin_heritage
"%u," // drakkin_tattoo
"%u," // drakkin_details
"%i," // toxicity
"%i," // hunger_level
"%i," // thirst_level
"%u," // ability_up
"%u," // zone_id
"%u," // zone_instance
"%u," // leadership_exp_on
"%u," // ldon_points_guk
"%u," // ldon_points_mir
"%u," // ldon_points_mmc
"%u," // ldon_points_ruj
"%u," // ldon_points_tak
"%u," // ldon_points_available
"%u," // tribute_time_remaining
"%u," // show_helm
"%u," // career_tribute_points
"%u," // tribute_points
"%u," // tribute_active
"%u," // endurance
"%u," // group_leadership_exp
"%u," // raid_leadership_exp
"%u," // show_helm
"%u," // career_tribute_points
"%u," // tribute_points
"%u," // tribute_active
"%u," // endurance
"%u," // group_leadership_exp
"%u," // raid_leadership_exp
"%u," // group_leadership_point
"%u," // raid_leadership_points
"%u," // air_remaining
"%u," // pvp_kills
"%u," // pvp_deaths
"%u," // pvp_current_points
"%u," // pvp_career_points
"%u," // pvp_best_kill_streak
"%u," // air_remaining
"%u," // pvp_kills
"%u," // pvp_deaths
"%u," // pvp_current_points
"%u," // pvp_career_points
"%u," // pvp_best_kill_streak
"%u," // pvp_worst_death_streak
"%u," // pvp_current_kill_strea
"%u," // aa_points_spent
"%u," // aa_exp
"%u," // aa_points
"%u," // group_auto_consent
"%u," // raid_auto_consent
"%u," // guild_auto_consent
"%u" // RestTimer
"%u," // aa_points_spent
"%u," // aa_exp
"%u," // aa_points
"%u," // group_auto_consent
"%u," // raid_auto_consent
"%u," // guild_auto_consent
"%u" // RestTimer
")",
character_id, // " id, "
account_id, // " account_id, "
@@ -750,61 +750,6 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
return true;
}
/* This only for new Character creation storing */
bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQ::InventoryProfile* inv) {
uint32 charid = 0;
char zone[50];
float x, y, z;
charid = GetCharacterID(pp->name);
if(!charid) {
LogError("StoreCharacter: no character id");
return false;
}
const char *zname = GetZoneName(pp->zone_id);
if(zname == nullptr) {
/* Zone not in the DB, something to prevent crash... */
strn0cpy(zone, "qeynos", 49);
pp->zone_id = 1;
}
else{ strn0cpy(zone, zname, 49); }
x = pp->x;
y = pp->y;
z = pp->z;
/* Saves Player Profile Data */
SaveCharacterCreate(charid, account_id, pp);
/* Insert starting inventory... */
std::string invquery;
for (int16 i = EQ::invslot::EQUIPMENT_BEGIN; i <= EQ::invbag::BANK_BAGS_END;) {
const EQ::ItemInstance* newinv = inv->GetItem(i);
if (newinv) {
invquery = StringFormat("INSERT INTO `inventory` (charid, slotid, itemid, charges, color) VALUES (%u, %i, %u, %i, %u)",
charid, i, newinv->GetItem()->ID, newinv->GetCharges(), newinv->GetColor());
auto results = QueryDatabase(invquery);
}
if (i == EQ::invslot::slotCursor) {
i = EQ::invbag::GENERAL_BAGS_BEGIN;
continue;
}
else if (i == EQ::invbag::CURSOR_BAG_END) {
i = EQ::invslot::BANK_BEGIN;
continue;
}
else if (i == EQ::invslot::BANK_END) {
i = EQ::invbag::BANK_BAGS_BEGIN;
continue;
}
i++;
}
return true;
}
uint32 Database::GetCharacterID(const char *name) {
std::string query = StringFormat("SELECT `id` FROM `character_data` WHERE `name` = '%s'", name);
auto results = QueryDatabase(query);
@@ -1137,50 +1082,6 @@ bool Database::GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zon
return true;
}
bool Database::LoadZoneNames() {
std::string query("SELECT zoneidnumber, short_name FROM zone");
auto results = QueryDatabase(query);
if (!results.Success())
{
return false;
}
for (auto row= results.begin();row != results.end();++row)
{
uint32 zoneid = atoi(row[0]);
std::string zonename = row[1];
zonename_array.insert(std::pair<uint32,std::string>(zoneid,zonename));
}
return true;
}
uint32 Database::GetZoneID(const char* zonename) {
if (zonename == nullptr)
return 0;
for (auto iter = zonename_array.begin(); iter != zonename_array.end(); ++iter)
if (strcasecmp(iter->second.c_str(), zonename) == 0)
return iter->first;
return 0;
}
const char* Database::GetZoneName(uint32 zoneID, bool ErrorUnknown) {
auto iter = zonename_array.find(zoneID);
if (iter != zonename_array.end())
return iter->second.c_str();
if (ErrorUnknown)
return "UNKNOWN";
return 0;
}
uint8 Database::GetPEQZone(uint32 zoneID, uint32 version){
std::string query = StringFormat("SELECT peqzone from zone where zoneidnumber='%i' AND (version=%i OR version=0) ORDER BY version DESC", zoneID, version);
@@ -1397,29 +1298,31 @@ uint8 Database::GetServerType() {
return atoi(row[0]);
}
bool Database::MoveCharacterToZone(const char* charname, const char* zonename, uint32 zoneid) {
if(zonename == nullptr || strlen(zonename) == 0)
return false;
bool Database::MoveCharacterToZone(uint32 character_id, uint32 zone_id)
{
std::string query = StringFormat(
"UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `id` = %i",
zone_id,
character_id
);
std::string query = StringFormat("UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `name` = '%s'", zoneid, charname);
auto results = QueryDatabase(query);
if (!results.Success()) {
return false;
}
if (results.RowsAffected() == 0)
return false;
return true;
return results.RowsAffected() != 0;
}
bool Database::MoveCharacterToZone(const char* charname, const char* zonename) {
return MoveCharacterToZone(charname, zonename, GetZoneID(zonename));
}
bool Database::MoveCharacterToZone(const char *charname, uint32 zone_id)
{
std::string query = StringFormat(
"UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `name` = '%s'",
zone_id,
charname
);
bool Database::MoveCharacterToZone(uint32 iCharID, const char* iZonename) {
std::string query = StringFormat("UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `id` = %i", GetZoneID(iZonename), iCharID);
auto results = QueryDatabase(query);
if (!results.Success()) {
@@ -2406,3 +2309,141 @@ int Database::GetInstanceID(uint32 char_id, uint32 zone_id) {
return 0;
}
/**
* @param source_character_name
* @param destination_character_name
* @param destination_account_name
* @return
*/
bool Database::CopyCharacter(
std::string source_character_name,
std::string destination_character_name,
std::string destination_account_name
)
{
auto results = QueryDatabase(
fmt::format(
"SELECT id FROM character_data WHERE name = '{}' and deleted_at is NULL LIMIT 1",
source_character_name
)
);
if (results.RowCount() == 0) {
LogError("No character found with name [{}]", source_character_name);
}
auto row = results.begin();
std::string source_character_id = row[0];
results = QueryDatabase(
fmt::format(
"SELECT id FROM account WHERE name = '{}' LIMIT 1",
destination_account_name
)
);
if (results.RowCount() == 0) {
LogError("No account found with name [{}]", destination_account_name);
}
row = results.begin();
std::string source_account_id = row[0];
/**
* Fresh ID
*/
results = QueryDatabase("SELECT (MAX(id) + 1) as new_id from character_data");
row = results.begin();
std::string new_character_id = row[0];
TransactionBegin();
for (const auto &iter : DatabaseSchema::GetCharacterTables()) {
std::string table_name = iter.first;
std::string character_id_column_name = iter.second;
/**
* Columns
*/
results = QueryDatabase(fmt::format("SHOW COLUMNS FROM {}", table_name));
std::vector<std::string> columns = {};
int column_count = 0;
for (row = results.begin(); row != results.end(); ++row) {
columns.emplace_back(row[0]);
column_count++;
}
results = QueryDatabase(
fmt::format(
"SELECT {} FROM {} WHERE {} = {}",
implode(",", wrap(columns, "`")),
table_name,
character_id_column_name,
source_character_id
)
);
std::vector<std::vector<std::string>> new_rows;
for (row = results.begin(); row != results.end(); ++row) {
std::vector<std::string> new_values = {};
for (int column_index = 0; column_index < column_count; column_index++) {
std::string column = columns[column_index];
std::string value = row[column_index] ? row[column_index] : "null";
if (column == character_id_column_name) {
value = new_character_id;
}
if (column == "name" && table_name == "character_data") {
value = destination_character_name;
}
if (column == "account_id" && table_name == "character_data") {
value = source_account_id;
}
new_values.emplace_back(value);
}
new_rows.emplace_back(new_values);
}
std::string insert_values;
std::vector<std::string> insert_rows;
for (auto &r: new_rows) {
std::string insert_row = "(" + implode(",", wrap(r, "'")) + ")";
insert_rows.emplace_back(insert_row);
}
if (!insert_rows.empty()) {
QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
table_name,
character_id_column_name,
new_character_id
)
);
auto insert = QueryDatabase(
fmt::format(
"INSERT INTO {} ({}) VALUES {}",
table_name,
implode(",", wrap(columns, "`")),
implode(",", insert_rows)
)
);
if (!insert.ErrorMessage().empty()) {
TransactionRollback();
return false;
break;
}
}
}
TransactionCommit();
return true;
}
+30 -20
View File
@@ -100,23 +100,40 @@ class Database : public DBcore {
public:
Database();
Database(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
bool Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port);
bool Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port, std::string connection_label = "default");
~Database();
/* Character Creation */
bool AddToNameFilter(const char* name);
bool CreateCharacter(uint32 account_id, char* name, uint16 gender, uint16 race, uint16 class_, uint8 str, uint8 sta, uint8 cha, uint8 dex, uint8 int_, uint8 agi, uint8 wis, uint8 face);
bool DeleteCharacter(char* character_name);
bool MoveCharacterToZone(const char* charname, const char* zonename);
bool MoveCharacterToZone(const char* charname, const char* zonename,uint32 zoneid);
bool MoveCharacterToZone(uint32 iCharID, const char* iZonename);
bool ReserveName(uint32 account_id, char* name);
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 StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQ::InventoryProfile* inv);
bool UpdateName(const char* oldname, const char* newname);
bool AddToNameFilter(const char *name);
bool CreateCharacter(
uint32 account_id,
char *name,
uint16 gender,
uint16 race,
uint16 class_,
uint8 str,
uint8 sta,
uint8 cha,
uint8 dex,
uint8 int_,
uint8 agi,
uint8 wis,
uint8 face
);
bool DeleteCharacter(char *character_name);
bool MoveCharacterToZone(const char *charname, uint32 zone_id);
bool MoveCharacterToZone(uint32 character_id, uint32 zone_id);
bool ReserveName(uint32 account_id, char *name);
bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct *pp);
bool 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 UpdateName(const char *oldname, const char *newname);
bool CopyCharacter(
std::string source_character_name,
std::string destination_character_name,
std::string destination_account_name
);
/* General Information Queries */
@@ -156,7 +173,6 @@ public:
bool VerifyInstanceAlive(uint16 instance_id, uint32 char_id);
bool VerifyZoneInstance(uint32 zone_id, uint16 instance_id);
uint16 GetInstanceID(const char* zone, uint32 charid, int16 version);
uint16 GetInstanceID(uint32 zone, uint32 charid, int16 version);
uint16 GetInstanceVersion(uint16 instance_id);
uint32 GetTimeRemainingInstance(uint16 instance_id, bool &is_perma);
@@ -244,16 +260,11 @@ 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(uint32 zoneID, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr) { return GetSafePoints(GetZoneName(zoneID), version, safe_x, safe_y, safe_z, minstatus, minlevel, flag_needed); }
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);
bool LoadZoneNames();
const char* GetZoneName(uint32 zoneID, bool ErrorUnknown = false);
uint32 GetZoneGraveyardID(uint32 zone_id, uint32 version);
uint32 GetZoneID(const char* zonename);
uint8 GetPEQZone(uint32 zoneID, uint32 version);
uint8 GetRaceSkill(uint8 skillid, uint8 in_race);
@@ -277,7 +288,6 @@ public:
void LoadLogSettings(EQEmuLogSys::LogSettings* log_settings);
private:
std::map<uint32,std::string> zonename_array;
Mutex Mvarcache;
VarCache_Struct varcache;
+12 -1
View File
@@ -128,12 +128,23 @@ std::string DatabaseDumpService::GetMySQLVersion()
std::string DatabaseDumpService::GetBaseMySQLDumpCommand()
{
auto config = EQEmuConfig::get();
if (IsDumpContentTables() && !config->ContentDbHost.empty()) {
return fmt::format(
"mysqldump -u {} -p{} -h {} --port={} {}",
config->ContentDbUsername,
config->ContentDbPassword,
config->ContentDbHost,
config->ContentDbPort,
config->ContentDbName
);
};
return fmt::format(
"mysqldump -u {} -p{} -h {} {}",
"mysqldump -u {} -p{} -h {} --port={} {}",
config->DatabaseUsername,
config->DatabasePassword,
config->DatabaseHost,
config->DatabasePort,
config->DatabaseDB
);
}
+22 -42
View File
@@ -34,6 +34,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#define strcasecmp _stricmp
#else
#include "unix.h"
#include "../zone/zonedb.h"
#include <netinet/in.h>
#include <sys/time.h>
#endif
@@ -305,36 +306,6 @@ bool Database::VerifyZoneInstance(uint32 zone_id, uint16 instance_id)
return true;
}
uint16 Database::GetInstanceID(const char* zone, uint32 character_id, int16 version) {
std::string query = StringFormat(
"SELECT "
"instance_list.id "
"FROM "
"instance_list, "
"instance_list_player "
"WHERE "
"instance_list.zone = %u "
"AND instance_list.version = %u "
"AND instance_list.id = instance_list_player.id "
"AND instance_list_player.charid = %u "
"LIMIT 1 ",
GetZoneID(zone),
version,
character_id
);
auto results = QueryDatabase(query);
if (!results.Success())
return 0;
if (results.RowCount() == 0)
return 0;
auto row = results.begin();
return atoi(row[0]);
}
uint16 Database::GetInstanceID(uint32 zone, uint32 character_id, int16 version)
{
if (!zone)
@@ -501,22 +472,18 @@ void Database::AssignRaidToInstance(uint32 raid_id, uint32 instance_id)
}
void Database::BuryCorpsesInInstance(uint16 instance_id) {
std::string query = StringFormat(
"UPDATE `character_corpses` "
"SET `is_buried` = 1, "
"`instance_id` = 0 "
"WHERE "
"`instance_id` = %u ",
instance_id
);
auto results = QueryDatabase(query);
QueryDatabase(
fmt::format(
"UPDATE character_corpses SET is_buried = 1, instance_id = 0 WHERE instance_id = {}",
instance_id
)
);
}
void Database::DeleteInstance(uint16 instance_id)
{
std::string query;
query = StringFormat("DELETE FROM instance_list_player WHERE id=%u", instance_id);
QueryDatabase(query);
@@ -526,6 +493,9 @@ 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);
BuryCorpsesInInstance(instance_id);
}
@@ -603,9 +573,19 @@ void Database::PurgeExpiredInstances()
return;
}
std::vector<std::string> instance_ids;
for (auto row = results.begin(); row != results.end(); ++row) {
DeleteInstance(atoi(row[0]));
instance_ids.emplace_back(row[0]);
}
std::string imploded_instance_ids = implode(",", instance_ids);
QueryDatabase(fmt::format("DELETE FROM instance_list WHERE id IN ({})", imploded_instance_ids));
QueryDatabase(fmt::format("DELETE FROM instance_list_player WHERE id IN ({})", imploded_instance_ids));
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));
}
void Database::SetInstanceDuration(uint16 instance_id, uint32 new_duration)
+10 -13
View File
@@ -50,6 +50,7 @@ namespace DatabaseSchema {
{"character_data", "id"},
{"character_disciplines", "id"},
{"character_enabledtasks", "charid"},
{"character_expedition_lockouts", "character_id"},
{"character_inspect_messages", "id"},
{"character_item_recast", "id"},
{"character_languages", "id"},
@@ -114,6 +115,7 @@ namespace DatabaseSchema {
"character_data",
"character_disciplines",
"character_enabledtasks",
"character_expedition_lockouts",
"character_inspect_messages",
"character_item_recast",
"character_languages",
@@ -166,16 +168,12 @@ namespace DatabaseSchema {
{
return {
"aa_ability",
"aa_actions",
"aa_effects",
"aa_rank_effects",
"aa_rank_prereqs",
"aa_ranks",
"aa_required_level_cost",
"adventure_template",
"adventure_template_entry",
"adventure_template_entry_flavor",
"altadv_vars",
"alternate_currency",
"auras",
"base_data",
@@ -183,13 +181,11 @@ namespace DatabaseSchema {
"books",
"char_create_combinations",
"char_create_point_allocations",
"class_skill",
"damageshieldtypes",
"doors",
"faction_base_data",
"faction_list",
"faction_list_mod",
"fear_hints",
"fishing",
"forage",
"global_loot",
@@ -199,7 +195,6 @@ namespace DatabaseSchema {
"grid_entries",
"ground_spawns",
"horses",
"instance_list",
"items",
"ldon_trap_entries",
"ldon_trap_templates",
@@ -217,19 +212,15 @@ namespace DatabaseSchema {
"npc_spells_effects_entries",
"npc_spells_entries",
"npc_types",
"npc_types_metadata",
"npc_types_tint",
"object",
"pets",
"pets_equipmentset",
"pets_equipmentset_entries",
"proximities",
"races",
"skill_caps",
"spawn2",
"spawn_condition_values",
"spawn_conditions",
"spawn_events",
"spawnentry",
"spawngroup",
"spells_new",
@@ -246,8 +237,6 @@ namespace DatabaseSchema {
"veteran_reward_templates",
"zone",
"zone_points",
"zone_server",
"zoneserver_auth",
};
}
@@ -261,10 +250,13 @@ namespace DatabaseSchema {
return {
"chatchannels",
"command_settings",
"content_flags",
"db_str",
"eqtime",
"launcher",
"launcher_zones",
"spawn_condition_values",
"spawn_events",
"level_exp_mods",
"logsys_categories",
"name_filter",
@@ -315,12 +307,17 @@ namespace DatabaseSchema {
"banned_ips",
"bug_reports",
"bugs",
"dynamic_zones",
"eventlog",
"expedition_lockouts",
"expedition_members",
"expeditions",
"gm_ips",
"group_id",
"group_leaders",
"hackers",
"ip_exemptions",
"instance_list",
"item_tick",
"lfguild",
"merchantlist_temp",
+46 -10
View File
@@ -35,17 +35,31 @@
DBcore::DBcore()
{
mysql_init(&mysql);
pHost = 0;
pUser = 0;
pPassword = 0;
pDatabase = 0;
pCompress = false;
pSSL = false;
pStatus = Closed;
pHost = nullptr;
pUser = nullptr;
pPassword = nullptr;
pDatabase = nullptr;
pCompress = false;
pSSL = false;
pStatus = Closed;
}
DBcore::~DBcore()
{
/**
* This prevents us from doing a double free in multi-tenancy setups where we
* are re-using the default database connection pointer when we dont have an
* external configuration setup ex: (content_database)
*/
std::string mysql_connection_host;
if (mysql.host) {
mysql_connection_host = mysql.host;
}
if (GetOriginHost() != mysql_connection_host) {
return;
}
mysql_close(&mysql);
safe_delete_array(pHost);
safe_delete_array(pUser);
@@ -69,6 +83,13 @@ MySQLRequestResult DBcore::QueryDatabase(std::string query, bool retryOnFailureO
return QueryDatabase(query.c_str(), query.length(), retryOnFailureOnce);
}
bool DBcore::DoesTableExist(std::string table_name)
{
auto results = QueryDatabase(fmt::format("SHOW TABLES LIKE '{}'", table_name));
return results.RowCount() > 0;
}
MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, bool retryOnFailureOnce)
{
BenchTimer timer;
@@ -81,6 +102,8 @@ MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, boo
Open();
}
// request query. != 0 indicates some kind of error.
if (mysql_real_query(&mysql, query, querylen) != 0) {
unsigned int errorNumber = mysql_errno(&mysql);
@@ -244,6 +267,10 @@ bool DBcore::Open(uint32 *errnum, char *errbuf)
}
if (mysql_real_connect(&mysql, pHost, pUser, pPassword, pDatabase, pPort, 0, flags)) {
pStatus = Connected;
std::string connected_origin_host = pHost;
SetOriginHost(connected_origin_host);
return true;
}
else {
@@ -258,8 +285,17 @@ bool DBcore::Open(uint32 *errnum, char *errbuf)
}
}
void DBcore::SetMysql(MYSQL *mysql)
{
DBcore::mysql = *mysql;
}
const std::string &DBcore::GetOriginHost() const
{
return origin_host;
}
void DBcore::SetOriginHost(const std::string &origin_host)
{
DBcore::origin_host = origin_host;
}
+42 -21
View File
@@ -2,8 +2,8 @@
#define DBCORE_H
#ifdef _WINDOWS
#include <winsock2.h>
#include <windows.h>
#include <winsock2.h>
#include <windows.h>
#endif
#include "../common/mutex.h"
@@ -15,36 +15,57 @@
class DBcore {
public:
enum eStatus { Closed, Connected, Error };
enum eStatus {
Closed, Connected, Error
};
DBcore();
~DBcore();
eStatus GetStatus() { return pStatus; }
MySQLRequestResult QueryDatabase(const char* query, uint32 querylen, bool retryOnFailureOnce = true);
MySQLRequestResult QueryDatabase(std::string query, bool retryOnFailureOnce = true);
eStatus GetStatus() { return pStatus; }
MySQLRequestResult QueryDatabase(const char *query, uint32 querylen, bool retryOnFailureOnce = true);
MySQLRequestResult QueryDatabase(std::string query, bool retryOnFailureOnce = true);
void TransactionBegin();
void TransactionCommit();
void TransactionRollback();
uint32 DoEscapeString(char* tobuf, const char* frombuf, uint32 fromlen);
void ping();
MYSQL* getMySQL(){ return &mysql; }
uint32 DoEscapeString(char *tobuf, const char *frombuf, uint32 fromlen);
void ping();
MYSQL *getMySQL() { return &mysql; }
void SetMysql(MYSQL *mysql);
const std::string &GetOriginHost() const;
void SetOriginHost(const std::string &origin_host);
bool DoesTableExist(std::string table_name);
protected:
bool Open(const char* iHost, const char* iUser, const char* iPassword, const char* iDatabase, uint32 iPort, uint32* errnum = 0, char* errbuf = 0, bool iCompress = false, bool iSSL = false);
private:
bool Open(uint32* errnum = 0, char* errbuf = 0);
bool Open(
const char *iHost,
const char *iUser,
const char *iPassword,
const char *iDatabase,
uint32 iPort,
uint32 *errnum = 0,
char *errbuf = 0,
bool iCompress = false,
bool iSSL = false
);
MYSQL mysql;
Mutex MDatabase;
private:
bool Open(uint32 *errnum = nullptr, char *errbuf = nullptr);
MYSQL mysql;
Mutex MDatabase;
eStatus pStatus;
char* pHost;
char* pUser;
char* pPassword;
char* pDatabase;
bool pCompress;
uint32 pPort;
bool pSSL;
std::string origin_host;
char *pHost;
char *pUser;
char *pPassword;
char *pDatabase;
bool pCompress;
uint32 pPort;
bool pSSL;
};
+8 -7
View File
@@ -1,8 +1,6 @@
// system use
N(OP_ExploreUnknown),
// start (please add new opcodes in descending order and re-order any name changes where applicable)
N(OP_0x0193),
N(OP_0x0347),
N(OP_AAAction),
N(OP_AAExpUpdate),
N(OP_AcceptNewTask),
@@ -136,20 +134,22 @@ N(OP_Dye),
N(OP_DynamicWall),
N(OP_DzAddPlayer),
N(OP_DzChooseZone),
N(OP_DzChooseZoneReply),
N(OP_DzCompass),
N(OP_DzExpeditionEndsWarning),
N(OP_DzExpeditionInfo),
N(OP_DzExpeditionList),
N(OP_DzJoinExpeditionConfirm),
N(OP_DzJoinExpeditionReply),
N(OP_DzLeaderStatus),
N(OP_DzExpeditionInvite),
N(OP_DzExpeditionInviteResponse),
N(OP_DzExpeditionLockoutTimers),
N(OP_DzListTimers),
N(OP_DzMakeLeader),
N(OP_DzMemberList),
N(OP_DzMemberStatus),
N(OP_DzMemberListName),
N(OP_DzMemberListStatus),
N(OP_DzPlayerList),
N(OP_DzQuit),
N(OP_DzRemovePlayer),
N(OP_DzSetLeaderName),
N(OP_DzSwapPlayer),
N(OP_Emote),
N(OP_EndLootRequest),
@@ -271,6 +271,7 @@ N(OP_ItemVerifyRequest),
N(OP_ItemViewUnknown),
N(OP_Jump),
N(OP_KeyRing),
N(OP_KickPlayers),
N(OP_KnowledgeBase),
N(OP_LDoNButton),
N(OP_LDoNDisarmTraps),
+150 -45
View File
@@ -375,13 +375,16 @@ struct NewZone_Struct {
/*0686*/ uint16 zone_instance;
/*0688*/ uint32 unknown688;
/*0692*/ uint8 unknown692[8];
// Titanium doesn't have a translator, but we can still safely add stuff under here without issues since client memcpy's only what it knows
// Just wastes some bandwidth sending to tit clients /shrug
/*0700*/ float fog_density;
/*0704*/ uint32 SuspendBuffs;
/*0708*/ uint32 FastRegenHP;
/*0712*/ uint32 FastRegenMana;
/*0716*/ uint32 FastRegenEndurance;
/*0720*/ uint32 NPCAggroMaxDist;
/*0724*/
/*0724*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, if this value is 0, it prevents you from running off edges that would end up underworld
/*0728*/
};
/*
@@ -4832,17 +4835,98 @@ struct BuffIcon_Struct
BuffIconEntry_Struct entries[0];
};
struct ExpeditionInfo_Struct
struct ExpeditionInvite_Struct
{
/*000*/ uint32 max_players;
/*004*/ char expedition_name[128];
/*132*/ char leader_name[64];
/*000*/ uint32 client_id; // unique character id
/*004*/ uint32 unknown004; // added after titanium
/*008*/ char inviter_name[64];
/*072*/ char expedition_name[128];
/*200*/ uint8 swapping; // 0: adding 1: swapping
/*201*/ char swap_name[64]; // if swapping, swap name being removed
/*265*/ uint8 padding[3];
/*268*/ uint16 dz_zone_id; // dz_id zone/instance pair, sent back in reply
/*270*/ uint16 dz_instance_id;
};
struct ExpeditionJoinPrompt_Struct
struct ExpeditionInviteResponse_Struct
{
/*000*/ char player_name[64];
/*064*/ char expedition_name[64];
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004; // added after titanium
/*008*/ uint16 dz_zone_id; // dz_id pair sent in invite
/*010*/ uint16 dz_instance_id;
/*012*/ uint8 accepted; // 0: declined 1: accepted
/*013*/ uint8 swapping; // 0: adding 1: swapping (sent in invite)
/*014*/ char swap_name[64]; // swap name sent in invite
/*078*/ uint8 unknown078; // padding garbage?
/*079*/ uint8 unknown079; // padding garbage?
};
struct ExpeditionInfo_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
/*012*/ uint32 max_players;
/*016*/ char expedition_name[128];
/*144*/ char leader_name[64];
};
struct ExpeditionMemberEntry_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
};
struct ExpeditionMemberList_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 member_count;
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
};
struct ExpeditionMemberListName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
/*012*/ char name[64];
};
struct ExpeditionLockoutTimerEntry_Struct
{
/*000*/ char expedition_name[128]; // variable length, null terminated, max 0x80 (128)
/*000*/ uint32 seconds_remaining;
/*000*/ int32 event_type; // seen -1 (0xffffffff) for replay timers and 1 for event timers
/*000*/ char event_name[256]; // variable length, null terminated, max 0x100 (256)
};
struct ExpeditionLockoutTimers_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
};
struct ExpeditionSetLeaderName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ char leader_name[64];
};
struct ExpeditionCommand_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ char name[64];
};
struct ExpeditionCommandSwap_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ char add_player_name[64]; // swap to (player must confirm)
/*072*/ char rem_player_name[64]; // swap from
};
struct ExpeditionExpireWarning
@@ -4850,48 +4934,67 @@ struct ExpeditionExpireWarning
/*008*/ uint32 minutes_remaining;
};
struct ExpeditionCompassEntry_Struct
struct DynamicZoneCompassEntry_Struct
{
/*000*/ uint32 enabled; //guess
/*004*/ float y;
/*008*/ float x;
/*012*/ float z;
/*000*/ uint16 dz_zone_id; // target dz id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
/*008*/ uint32 unknown008;
/*012*/ float y;
/*016*/ float x;
/*020*/ float z;
};
struct ExpeditionCompass_Struct
struct DynamicZoneCompass_Struct
{
/*000*/ uint32 client_id;
/*000*/ uint32 count;
/*004*/ ExpeditionCompassEntry_Struct entries[0];
/*004*/ DynamicZoneCompassEntry_Struct entries[0];
};
struct ExpeditionMemberEntry_Struct
struct DynamicZoneChooseZoneEntry_Struct
{
char name[64];
char status;
/*000*/ uint16 dz_zone_id; // dz_id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 unknown_id1; // seen 28 00 00 00 (40), sent back in reply
/*008*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest -- sent back in reply
/*012*/ uint32 unknown_id2; // possibly an id based on dz type, for expeditions this was same as dz_id (zone|instance) but task dz was different
/*016*/ char description[128]; // variable length, null terminated
/*144*/ char leader_name[64]; // variable length, null terminated
};
struct ExpeditionMemberList_Struct
struct DynamicZoneChooseZone_Struct
{
/*000*/ uint32 count;
/*004*/ ExpeditionMemberEntry_Struct entries[0];
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ DynamicZoneChooseZoneEntry_Struct choices[0];
};
struct ExpeditionLockoutEntry_Struct
struct DynamicZoneChooseZoneReply_Struct
{
/*000*/ uint32 time_left;
/*004*/ char expedition[128];
/*132*/ char expedition_event[128];
/*000*/ uint32 unknown000; // ff ff ff ff
/*004*/ uint32 unknown004; // seen 69 00 00 00
/*008*/ uint32 unknown008; // ff ff ff ff
/*012*/ uint32 unknown_id1; // from choose zone entry message
/*016*/ uint16 dz_zone_id; // dz_id pair
/*018*/ uint16 dz_instance_id;
/*020*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest
/*024*/ uint32 unknown_id2; // from choose zone entry message
/*028*/ uint32 unknown028; // 00 00 00 00
/*032*/ uint32 unknown032; // always same as unknown044
/*036*/ uint32 unknown036;
/*040*/ uint32 unknown040;
/*044*/ uint32 unknown044; // always same as unknown032
/*048*/ uint32 unknown048; // seen 01 00 00 00 and 02 00 00 00
};
struct ExpeditionLockoutList_Struct
struct KickPlayers_Struct
{
/*000*/ uint32 count;
/*004*/ ExpeditionLockoutEntry_Struct entries[0];
};
struct ExpeditionLeaderSet_Struct
{
/*000*/ char leader_name[64];
/*000*/ char char_name[64];
/*064*/ uint32 unknown064; // always 0
/*068*/ uint8 kick_expedition; // true if /kickplayers exp
/*069*/ uint8 kick_task; // true if /kickplayers task
/*070*/ uint8 padding[2];
};
struct CorpseDrag_Struct
@@ -5341,18 +5444,20 @@ struct MercenaryMerchantResponse_Struct {
struct ServerLootItem_Struct {
uint32 item_id; // uint32 item_id;
int16 equip_slot; // int16 equip_slot;
uint16 charges; // uint8 charges;
uint16 lootslot; // uint16 lootslot;
uint32 aug_1; // uint32 aug_1;
uint32 aug_2; // uint32 aug_2;
uint32 aug_3; // uint32 aug_3;
uint32 aug_4; // uint32 aug_4;
uint32 aug_5; // uint32 aug_5;
uint32 aug_6; // uint32 aug_5;
uint8 attuned;
uint8 min_level;
uint8 max_level;
int16 equip_slot; // int16 equip_slot;
uint16 charges; // uint8 charges;
uint16 lootslot; // uint16 lootslot;
uint32 aug_1; // uint32 aug_1;
uint32 aug_2; // uint32 aug_2;
uint32 aug_3; // uint32 aug_3;
uint32 aug_4; // uint32 aug_4;
uint32 aug_5; // uint32 aug_5;
uint32 aug_6; // uint32 aug_5;
uint8 attuned;
uint16 trivial_min_level;
uint16 trivial_max_level;
uint16 npc_min_level;
uint16 npc_max_level;
};
//Found in client near a ref to the string:
+9
View File
@@ -104,6 +104,15 @@ void EQEmuConfig::parse_config()
DatabasePort = atoi(_root["server"]["database"].get("port", "3306").asString().c_str());
DatabaseDB = _root["server"]["database"].get("db", "eq").asString();
/**
* Content Database
*/
ContentDbUsername = _root["server"]["content_database"].get("username", "").asString();
ContentDbPassword = _root["server"]["content_database"].get("password", "").asString();
ContentDbHost = _root["server"]["content_database"].get("host", "").asString();
ContentDbPort = atoi(_root["server"]["content_database"].get("port", 0).asString().c_str());
ContentDbName = _root["server"]["content_database"].get("db", "").asString();
/**
* QS
*/
+7
View File
@@ -74,6 +74,13 @@ class EQEmuConfig
std::string DatabaseDB;
uint16 DatabasePort;
// From <content_database/>
std::string ContentDbHost;
std::string ContentDbUsername;
std::string ContentDbPassword;
std::string ContentDbName;
uint16 ContentDbPort;
// From <qsdatabase> // QueryServ
std::string QSDatabaseHost;
std::string QSDatabaseUsername;
+1
View File
@@ -126,6 +126,7 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
log_settings[Logs::NPCScaling].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::HotReload].log_to_gmsay = static_cast<uint8>(Logs::General);
log_settings[Logs::HotReload].log_to_console = static_cast<uint8>(Logs::General);
log_settings[Logs::Loot].log_to_gmsay = static_cast<uint8>(Logs::General);
/**
* RFC 5424
+12
View File
@@ -115,6 +115,12 @@ namespace Logs {
Flee,
Aura,
HotReload,
Merchants,
ZonePoints,
Loot,
Expeditions,
DynamicZones,
Group,
MaxCategoryID /* Don't Remove this */
};
@@ -189,6 +195,12 @@ namespace Logs {
"Flee",
"Aura",
"HotReload",
"Merchants",
"ZonePoints",
"Loot",
"Expeditions",
"DynamicZones",
"Group",
};
}
+99 -1
View File
@@ -161,6 +161,16 @@
OutF(LogSys, Logs::Detail, Logs::Doors, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogGroup(message, ...) do {\
if (LogSys.log_settings[Logs::Group].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::Group, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogGroupDetail(message, ...) do {\
if (LogSys.log_settings[Logs::Group].is_category_enabled == 1)\
OutF(LogSys, Logs::Detail, Logs::Group, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogGuilds(message, ...) do {\
if (LogSys.log_settings[Logs::Guilds].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::Guilds, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
@@ -571,6 +581,61 @@
OutF(LogSys, Logs::Detail, Logs::HotReload, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogMerchants(message, ...) do {\
if (LogSys.log_settings[Logs::Merchants].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::Merchants, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogMerchantsDetail(message, ...) do {\
if (LogSys.log_settings[Logs::Merchants].is_category_enabled == 1)\
OutF(LogSys, Logs::Detail, Logs::Merchants, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogZonePoints(message, ...) do {\
if (LogSys.log_settings[Logs::ZonePoints].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::ZonePoints, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogZonePointsDetail(message, ...) do {\
if (LogSys.log_settings[Logs::ZonePoints].is_category_enabled == 1)\
OutF(LogSys, Logs::Detail, Logs::ZonePoints, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogLoot(message, ...) do {\
if (LogSys.log_settings[Logs::Loot].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::Loot, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogLootDetail(message, ...) do {\
if (LogSys.log_settings[Logs::Loot].is_category_enabled == 1)\
OutF(LogSys, Logs::Detail, Logs::Loot, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogExpeditions(message, ...) do {\
if (LogSys.log_settings[Logs::Expeditions].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::Expeditions, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogExpeditionsModerate(message, ...) do {\
if (LogSys.log_settings[Logs::Expeditions].is_category_enabled == 1)\
OutF(LogSys, Logs::Moderate, Logs::Expeditions, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogExpeditionsDetail(message, ...) do {\
if (LogSys.log_settings[Logs::Expeditions].is_category_enabled == 1)\
OutF(LogSys, Logs::Detail, Logs::Expeditions, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogDynamicZones(message, ...) do {\
if (LogSys.log_settings[Logs::DynamicZones].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::DynamicZones, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogDynamicZonesDetail(message, ...) do {\
if (LogSys.log_settings[Logs::DynamicZones].is_category_enabled == 1)\
OutF(LogSys, Logs::Detail, Logs::DynamicZones, __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__);\
@@ -664,6 +729,12 @@
#define LogDoorsDetail(message, ...) do {\
} while (0)
#define LogGroup(message, ...) do {\
} while (0)
#define LogGroupDetail(message, ...) do {\
} while (0)
#define LogGuilds(message, ...) do {\
} while (0)
@@ -910,6 +981,33 @@
#define LogHotReloadDetail(message, ...) do {\
} while (0)
#define LogMerchants(message, ...) do {\
} while (0)
#define LogMerchantsDetail(message, ...) do {\
} while (0)
#define LogZonePoints(message, ...) do {\
} while (0)
#define LogZonePointsDetail(message, ...) do {\
} while (0)
#define LogExpeditions(message, ...) do {\
} while (0)
#define LogExpeditionsModerate(message, ...) do {\
} while (0)
#define LogExpeditionsDetail(message, ...) do {\
} while (0)
#define LogDynamicZones(message, ...) do {\
} while (0)
#define LogDynamicZonesDetail(message, ...) do {\
} while (0)
#define Log(debug_level, log_category, message, ...) do {\
} while (0)
@@ -917,4 +1015,4 @@
} while (0)
#endif
#endif //EQEMU_EQEMU_LOGSYS_LOG_ALIASES_H
#endif //EQEMU_EQEMU_LOGSYS_LOG_ALIASES_H
+1 -1
View File
@@ -61,7 +61,7 @@ class SharedDatabase;
namespace EQ
{
class InventoryProfile;
class ItemInstance {
public:
/////////////////////////
+9 -7
View File
@@ -39,13 +39,15 @@ struct LootTable_Struct {
};
struct LootDropEntries_Struct {
uint32 item_id;
int8 item_charges;
uint8 equip_item;
float chance;
uint8 minlevel;
uint8 maxlevel;
uint8 multiplier;
uint32 item_id;
int8 item_charges;
uint8 equip_item;
float chance;
uint16 trivial_min_level;
uint16 trivial_max_level;
uint16 npc_min_level;
uint16 npc_max_level;
uint8 multiplier;
};
struct LootDrop_Struct {
+179 -71
View File
@@ -710,15 +710,48 @@ namespace RoF
FINISH_ENCODE();
}
ENCODE(OP_DzChooseZone)
{
SETUP_VAR_ENCODE(DynamicZoneChooseZone_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->count);
for (uint32 i = 0; i < emu->count; ++i)
{
buf.WriteUInt16(emu->choices[i].dz_zone_id);
buf.WriteUInt16(emu->choices[i].dz_instance_id);
buf.WriteUInt32(emu->choices[i].unknown_id1);
buf.WriteUInt32(emu->choices[i].dz_type);
buf.WriteUInt32(emu->choices[i].unknown_id2);
buf.WriteString(emu->choices[i].description);
buf.WriteString(emu->choices[i].leader_name);
}
__packet->size = buf.size();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzCompass)
{
SETUP_VAR_ENCODE(ExpeditionCompass_Struct);
ALLOC_VAR_ENCODE(structs::ExpeditionCompass_Struct, sizeof(structs::ExpeditionInfo_Struct) + sizeof(structs::ExpeditionCompassEntry_Struct) * emu->count);
SETUP_VAR_ENCODE(DynamicZoneCompass_Struct);
ALLOC_VAR_ENCODE(structs::DynamicZoneCompass_Struct,
sizeof(structs::DynamicZoneCompass_Struct) +
sizeof(structs::DynamicZoneCompassEntry_Struct) * emu->count
);
OUT(client_id);
OUT(count);
for (uint32 i = 0; i < emu->count; ++i)
{
OUT(entries[i].dz_zone_id);
OUT(entries[i].dz_instance_id);
OUT(entries[i].dz_type);
OUT(entries[i].x);
OUT(entries[i].y);
OUT(entries[i].z);
@@ -742,81 +775,60 @@ namespace RoF
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
OUT(client_id);
OUT(assigned);
OUT(max_players);
eq->unknown004 = 785316192;
eq->unknown008 = 435601;
strncpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strncpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionList)
ENCODE(OP_DzExpeditionInvite)
{
SETUP_VAR_ENCODE(ExpeditionLockoutList_Struct);
ENCODE_LENGTH_EXACT(ExpeditionInvite_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInvite_Struct, structs::ExpeditionInvite_Struct);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&emu->count, sizeof(uint32));
OUT(client_id);
strn0cpy(eq->inviter_name, emu->inviter_name, sizeof(eq->inviter_name));
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
OUT(swapping);
strn0cpy(eq->swap_name, emu->swap_name, sizeof(eq->swap_name));
OUT(dz_zone_id);
OUT(dz_instance_id);
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionLockoutTimers)
{
SETUP_VAR_ENCODE(ExpeditionLockoutTimers_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->count);
for (uint32 i = 0; i < emu->count; ++i)
{
ss.write(emu->entries[i].expedition, strlen(emu->entries[i].expedition));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&emu->entries[i].time_left, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write(emu->entries[i].expedition_event, strlen(emu->entries[i].expedition_event));
ss.write((const char*)&null_term, sizeof(char));
buf.WriteString(emu->timers[i].expedition_name);
buf.WriteUInt32(emu->timers[i].seconds_remaining);
buf.WriteInt32(emu->timers[i].event_type);
buf.WriteString(emu->timers[i].event_name);
}
__packet->size = ss.str().length();
__packet->size = buf.size();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzJoinExpeditionConfirm)
ENCODE(OP_DzSetLeaderName)
{
ENCODE_LENGTH_EXACT(ExpeditionJoinPrompt_Struct);
SETUP_DIRECT_ENCODE(ExpeditionJoinPrompt_Struct, structs::ExpeditionJoinPrompt_Struct);
ENCODE_LENGTH_EXACT(ExpeditionSetLeaderName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionSetLeaderName_Struct, structs::ExpeditionSetLeaderName_Struct);
strncpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strncpy(eq->player_name, emu->player_name, sizeof(eq->player_name));
FINISH_ENCODE();
}
ENCODE(OP_DzLeaderStatus)
{
SETUP_VAR_ENCODE(ExpeditionLeaderSet_Struct);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write(emu->leader_name, strlen(emu->leader_name));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));//0xffffffff
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));//1
ss.write((const char*)&client_id, sizeof(uint32));
__packet->size = ss.str().length();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
OUT(client_id);
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
FINISH_ENCODE();
}
@@ -825,26 +837,43 @@ namespace RoF
{
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&emu->count, sizeof(uint32));
for (uint32 i = 0; i < emu->count; ++i)
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->member_count);
for (uint32 i = 0; i < emu->member_count; ++i)
{
ss.write(emu->entries[i].name, strlen(emu->entries[i].name));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&emu->entries[i].status, sizeof(char));
buf.WriteString(emu->members[i].name);
buf.WriteUInt8(emu->members[i].expedition_status);
}
__packet->size = ss.str().length();
__packet->size = buf.size();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzMemberListName)
{
ENCODE_LENGTH_EXACT(ExpeditionMemberListName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionMemberListName_Struct, structs::ExpeditionMemberListName_Struct);
OUT(client_id);
OUT(add_name);
strn0cpy(eq->name, emu->name, sizeof(eq->name));
FINISH_ENCODE();
}
ENCODE(OP_DzMemberListStatus)
{
auto emu = reinterpret_cast<ExpeditionMemberList_Struct*>((*p)->pBuffer);
if (emu->member_count == 1)
{
ENCODE_FORWARD(OP_DzMemberList);
}
}
ENCODE(OP_Emote)
{
EQApplicationPacket *in = *p;
@@ -1827,6 +1856,7 @@ namespace RoF
OUT(FastRegenHP);
OUT(FastRegenMana);
OUT(FastRegenEndurance);
OUT(underworld_teleport_index);
eq->FogDensity = emu->fog_density;
@@ -4387,6 +4417,84 @@ namespace RoF
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzAddPlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzChooseZoneReply)
{
DECODE_LENGTH_EXACT(structs::DynamicZoneChooseZoneReply_Struct);
SETUP_DIRECT_DECODE(DynamicZoneChooseZoneReply_Struct, structs::DynamicZoneChooseZoneReply_Struct);
IN(unknown000);
IN(unknown004);
IN(unknown008);
IN(unknown_id1);
IN(dz_zone_id);
IN(dz_instance_id);
IN(dz_type);
IN(unknown_id2);
IN(unknown028);
IN(unknown032);
IN(unknown036);
IN(unknown040);
IN(unknown044);
IN(unknown048);
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzExpeditionInviteResponse)
{
DECODE_LENGTH_EXACT(structs::ExpeditionInviteResponse_Struct);
SETUP_DIRECT_DECODE(ExpeditionInviteResponse_Struct, structs::ExpeditionInviteResponse_Struct);
IN(dz_zone_id);
IN(dz_instance_id);
IN(accepted);
IN(swapping);
strn0cpy(emu->swap_name, eq->swap_name, sizeof(emu->swap_name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzMakeLeader)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzRemovePlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzSwapPlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommandSwap_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommandSwap_Struct, structs::ExpeditionCommandSwap_Struct);
strn0cpy(emu->add_player_name, eq->add_player_name, sizeof(emu->add_player_name));
strn0cpy(emu->rem_player_name, eq->rem_player_name, sizeof(emu->rem_player_name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_Emote)
{
unsigned char *__eq_buffer = __packet->pBuffer;
+179 -71
View File
@@ -759,15 +759,48 @@ namespace RoF2
FINISH_ENCODE();
}
ENCODE(OP_DzChooseZone)
{
SETUP_VAR_ENCODE(DynamicZoneChooseZone_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->count);
for (uint32 i = 0; i < emu->count; ++i)
{
buf.WriteUInt16(emu->choices[i].dz_zone_id);
buf.WriteUInt16(emu->choices[i].dz_instance_id);
buf.WriteUInt32(emu->choices[i].unknown_id1);
buf.WriteUInt32(emu->choices[i].dz_type);
buf.WriteUInt32(emu->choices[i].unknown_id2);
buf.WriteString(emu->choices[i].description);
buf.WriteString(emu->choices[i].leader_name);
}
__packet->size = buf.size();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzCompass)
{
SETUP_VAR_ENCODE(ExpeditionCompass_Struct);
ALLOC_VAR_ENCODE(structs::ExpeditionCompass_Struct, sizeof(structs::ExpeditionInfo_Struct) + sizeof(structs::ExpeditionCompassEntry_Struct) * emu->count);
SETUP_VAR_ENCODE(DynamicZoneCompass_Struct);
ALLOC_VAR_ENCODE(structs::DynamicZoneCompass_Struct,
sizeof(structs::DynamicZoneCompass_Struct) +
sizeof(structs::DynamicZoneCompassEntry_Struct) * emu->count
);
OUT(client_id);
OUT(count);
for (uint32 i = 0; i < emu->count; ++i)
{
OUT(entries[i].dz_zone_id);
OUT(entries[i].dz_instance_id);
OUT(entries[i].dz_type);
OUT(entries[i].x);
OUT(entries[i].y);
OUT(entries[i].z);
@@ -791,81 +824,60 @@ namespace RoF2
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
OUT(client_id);
OUT(assigned);
OUT(max_players);
eq->unknown004 = 785316192;
eq->unknown008 = 435601;
strncpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strncpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionList)
ENCODE(OP_DzExpeditionInvite)
{
SETUP_VAR_ENCODE(ExpeditionLockoutList_Struct);
ENCODE_LENGTH_EXACT(ExpeditionInvite_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInvite_Struct, structs::ExpeditionInvite_Struct);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&emu->count, sizeof(uint32));
OUT(client_id);
strn0cpy(eq->inviter_name, emu->inviter_name, sizeof(eq->inviter_name));
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
OUT(swapping);
strn0cpy(eq->swap_name, emu->swap_name, sizeof(eq->swap_name));
OUT(dz_zone_id);
OUT(dz_instance_id);
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionLockoutTimers)
{
SETUP_VAR_ENCODE(ExpeditionLockoutTimers_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->count);
for (uint32 i = 0; i < emu->count; ++i)
{
ss.write(emu->entries[i].expedition, strlen(emu->entries[i].expedition));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&emu->entries[i].time_left, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write(emu->entries[i].expedition_event, strlen(emu->entries[i].expedition_event));
ss.write((const char*)&null_term, sizeof(char));
buf.WriteString(emu->timers[i].expedition_name);
buf.WriteUInt32(emu->timers[i].seconds_remaining);
buf.WriteInt32(emu->timers[i].event_type);
buf.WriteString(emu->timers[i].event_name);
}
__packet->size = ss.str().length();
__packet->size = buf.size();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzJoinExpeditionConfirm)
ENCODE(OP_DzSetLeaderName)
{
ENCODE_LENGTH_EXACT(ExpeditionJoinPrompt_Struct);
SETUP_DIRECT_ENCODE(ExpeditionJoinPrompt_Struct, structs::ExpeditionJoinPrompt_Struct);
ENCODE_LENGTH_EXACT(ExpeditionSetLeaderName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionSetLeaderName_Struct, structs::ExpeditionSetLeaderName_Struct);
strncpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strncpy(eq->player_name, emu->player_name, sizeof(eq->player_name));
FINISH_ENCODE();
}
ENCODE(OP_DzLeaderStatus)
{
SETUP_VAR_ENCODE(ExpeditionLeaderSet_Struct);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write(emu->leader_name, strlen(emu->leader_name));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));//0xffffffff
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));//1
ss.write((const char*)&client_id, sizeof(uint32));
__packet->size = ss.str().length();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
OUT(client_id);
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
FINISH_ENCODE();
}
@@ -874,26 +886,43 @@ namespace RoF2
{
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&emu->count, sizeof(uint32));
for (uint32 i = 0; i < emu->count; ++i)
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->member_count);
for (uint32 i = 0; i < emu->member_count; ++i)
{
ss.write(emu->entries[i].name, strlen(emu->entries[i].name));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&emu->entries[i].status, sizeof(char));
buf.WriteString(emu->members[i].name);
buf.WriteUInt8(emu->members[i].expedition_status);
}
__packet->size = ss.str().length();
__packet->size = buf.size();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzMemberListName)
{
ENCODE_LENGTH_EXACT(ExpeditionMemberListName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionMemberListName_Struct, structs::ExpeditionMemberListName_Struct);
OUT(client_id);
OUT(add_name);
strn0cpy(eq->name, emu->name, sizeof(eq->name));
FINISH_ENCODE();
}
ENCODE(OP_DzMemberListStatus)
{
auto emu = reinterpret_cast<ExpeditionMemberList_Struct*>((*p)->pBuffer);
if (emu->member_count == 1)
{
ENCODE_FORWARD(OP_DzMemberList);
}
}
ENCODE(OP_Emote)
{
EQApplicationPacket *in = *p;
@@ -1876,6 +1905,7 @@ namespace RoF2
OUT(FastRegenHP);
OUT(FastRegenMana);
OUT(FastRegenEndurance);
OUT(underworld_teleport_index);
eq->FogDensity = emu->fog_density;
@@ -4584,6 +4614,84 @@ namespace RoF2
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzAddPlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzChooseZoneReply)
{
DECODE_LENGTH_EXACT(structs::DynamicZoneChooseZoneReply_Struct);
SETUP_DIRECT_DECODE(DynamicZoneChooseZoneReply_Struct, structs::DynamicZoneChooseZoneReply_Struct);
IN(unknown000);
IN(unknown004);
IN(unknown008);
IN(unknown_id1);
IN(dz_zone_id);
IN(dz_instance_id);
IN(dz_type);
IN(unknown_id2);
IN(unknown028);
IN(unknown032);
IN(unknown036);
IN(unknown040);
IN(unknown044);
IN(unknown048);
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzExpeditionInviteResponse)
{
DECODE_LENGTH_EXACT(structs::ExpeditionInviteResponse_Struct);
SETUP_DIRECT_DECODE(ExpeditionInviteResponse_Struct, structs::ExpeditionInviteResponse_Struct);
IN(dz_zone_id);
IN(dz_instance_id);
IN(accepted);
IN(swapping);
strn0cpy(emu->swap_name, eq->swap_name, sizeof(emu->swap_name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzMakeLeader)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzRemovePlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzSwapPlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommandSwap_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommandSwap_Struct, structs::ExpeditionCommandSwap_Struct);
strn0cpy(emu->add_player_name, eq->add_player_name, sizeof(emu->add_player_name));
strn0cpy(emu->rem_player_name, eq->rem_player_name, sizeof(emu->rem_player_name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_Emote)
{
unsigned char *__eq_buffer = __packet->pBuffer;
+12 -3
View File
@@ -58,13 +58,16 @@ E(OP_DeleteCharge)
E(OP_DeleteItem)
E(OP_DeleteSpawn)
E(OP_DisciplineUpdate)
E(OP_DzChooseZone)
E(OP_DzCompass)
E(OP_DzExpeditionEndsWarning)
E(OP_DzExpeditionInfo)
E(OP_DzExpeditionList)
E(OP_DzJoinExpeditionConfirm)
E(OP_DzLeaderStatus)
E(OP_DzExpeditionInvite)
E(OP_DzExpeditionLockoutTimers)
E(OP_DzMemberList)
E(OP_DzMemberListName)
E(OP_DzMemberListStatus)
E(OP_DzSetLeaderName)
E(OP_Emote)
E(OP_ExpansionInfo)
E(OP_FormattedMessage)
@@ -159,6 +162,12 @@ D(OP_ConsiderCorpse)
D(OP_Consume)
D(OP_Damage)
D(OP_DeleteItem)
D(OP_DzAddPlayer)
D(OP_DzChooseZoneReply)
D(OP_DzExpeditionInviteResponse)
D(OP_DzMakeLeader)
D(OP_DzRemovePlayer)
D(OP_DzSwapPlayer)
D(OP_Emote)
D(OP_EnvDamage)
D(OP_FaceChange)
+145 -28
View File
@@ -628,7 +628,7 @@ struct NewZone_Struct {
/*0856*/ uint32 scriptNPCReceivedanItem;
/*0860*/ uint32 bCheck; // padded bool
/*0864*/ uint32 scriptIDSomething;
/*0868*/ uint32 scriptIDSomething2;
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
/*0872*/ uint32 scriptIDSomething3;
/*0876*/ uint32 SuspendBuffs; // padded bool
/*0880*/ uint32 LavaDamage; // LavaDamage value
@@ -4882,52 +4882,169 @@ struct VeteranClaim
/*076*/ uint32 action;
};
struct ExpeditionEntryHeader_Struct
struct ExpeditionInvite_Struct
{
/*000*/ uint32 client_id; // unique character id
/*004*/ uint32 unknown004;
/*008*/ char inviter_name[64];
/*072*/ char expedition_name[128];
/*200*/ uint8 swapping; // 0: adding 1: swapping
/*201*/ char swap_name[64]; // if swapping, swap name being removed
/*265*/ uint8 padding[3];
/*268*/ uint16 dz_zone_id; // dz_id zone/instance pair, sent back in reply
/*270*/ uint16 dz_instance_id;
};
struct ExpeditionInviteResponse_Struct
{
/*000*/ uint32 unknown000;
/*000*/ uint32 number_of_entries;
};
struct ExpeditionJoinPrompt_Struct
{
/*000*/ uint32 clientid;
/*004*/ uint32 unknown004;
/*008*/ char player_name[64];
/*072*/ char expedition_name[64];
};
struct ExpeditionExpireWarning
{
/*000*/ uint32 clientid;
/*004*/ uint32 unknown004;
/*008*/ uint32 minutes_remaining;
/*008*/ uint16 dz_zone_id; // dz_id pair sent in invite
/*010*/ uint16 dz_instance_id;
/*012*/ uint8 accepted; // 0: declined 1: accepted
/*013*/ uint8 swapping; // 0: adding 1: swapping (sent in invite)
/*014*/ char swap_name[64]; // swap name sent in invite
/*078*/ uint8 unknown078; // padding garbage?
/*079*/ uint8 unknown079; // padding garbage?
};
struct ExpeditionInfo_Struct
{
/*000*/ uint32 clientid;
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 unknown008;
/*008*/ uint32 assigned; // padded bool, 0: not in expedition (clear data), 1: in expedition
/*012*/ uint32 max_players;
/*016*/ char expedition_name[128];
/*142*/ char leader_name[64];
/*016*/ char expedition_name[128];
/*144*/ char leader_name[64];
//*208*/ uint32 unknown208; // live sends 01 00 00 00 here but client doesn't read it
};
struct ExpeditionCompassEntry_Struct
struct ExpeditionMemberEntry_Struct
{
/*000*/ float unknown000; //seen *((uint32*)) = 1584791871
/*004*/ uint32 enabled; //guess
/*008*/ uint32 unknown008; //seen 1019
/*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
};
struct ExpeditionMemberList_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 member_count; // number of players in window
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
};
struct ExpeditionMemberListName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
/*012*/ char name[64];
};
struct ExpeditionLockoutTimerEntry_Struct
{
/*000*/ char expedition_name[1]; // variable length, null terminated, max 0x80 (128)
/*000*/ uint32 seconds_remaining;
/*000*/ int32 event_type; // seen -1 (0xffffffff) for replay timers and 1 for event timers
/*000*/ char event_name[1]; // variable length, null terminated, max 0x100 (256)
};
struct ExpeditionLockoutTimers_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
};
struct ExpeditionSetLeaderName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ char leader_name[64];
};
struct ExpeditionCommand_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ char name[64];
};
struct ExpeditionCommandSwap_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ char add_player_name[64]; // swap to (player must confirm)
/*072*/ char rem_player_name[64]; // swap from
};
struct ExpeditionExpireWarning
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 minutes_remaining;
};
struct DynamicZoneCompassEntry_Struct
{
/*000*/ uint16 dz_zone_id; // target dz id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
/*008*/ uint32 unknown008;
/*012*/ float y;
/*016*/ float x;
/*020*/ float z;
};
struct ExpeditionCompass_Struct
struct DynamicZoneCompass_Struct
{
/*000*/ uint32 clientid;
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ ExpeditionCompassEntry_Struct entries[0];
/*008*/ DynamicZoneCompassEntry_Struct entries[0];
};
struct DynamicZoneChooseZoneEntry_Struct
{
/*000*/ uint16 dz_zone_id; // dz_id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 unknown_id1; // seen 28 00 00 00 (40), sent back in reply
/*008*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest -- sent back in reply
/*012*/ uint32 unknown_id2; // possibly an id based on dz type, for expeditions this was same as dz_id (zone|instance) but task dz was different
/*016*/ char description[1]; // variable length, null terminated, max 0x80 (128)
/*000*/ char leader_name[1]; // variable length, null terminated, max 0x40 (64)
};
struct DynamicZoneChooseZone_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ DynamicZoneChooseZoneEntry_Struct choices[0];
};
struct DynamicZoneChooseZoneReply_Struct
{
/*000*/ uint32 unknown000; // ff ff ff ff
/*004*/ uint32 unknown004; // seen 69 00 00 00
/*008*/ uint32 unknown008; // ff ff ff ff
/*012*/ uint32 unknown_id1; // from choose zone entry message
/*016*/ uint16 dz_zone_id; // dz_id pair
/*018*/ uint16 dz_instance_id;
/*020*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest
/*024*/ uint32 unknown_id2; // from choose zone entry message
/*028*/ uint32 unknown028; // 00 00 00 00
/*032*/ uint32 unknown032; // always same as unknown044
/*036*/ uint32 unknown036;
/*040*/ uint32 unknown040;
/*044*/ uint32 unknown044; // always same as unknown032
/*048*/ uint32 unknown048; // seen 01 00 00 00 and 02 00 00 00
};
struct KickPlayers_Struct
{
/*000*/ char char_name[64];
/*064*/ uint32 unknown064; // always 0
/*068*/ uint8 kick_expedition; // true if /kickplayers exp
/*069*/ uint8 kick_task; // true if /kickplayers task
/*070*/ uint8 padding[2];
};
struct MaxCharacters_Struct
+12 -3
View File
@@ -44,13 +44,16 @@ E(OP_DeleteCharge)
E(OP_DeleteItem)
E(OP_DeleteSpawn)
E(OP_DisciplineUpdate)
E(OP_DzChooseZone)
E(OP_DzCompass)
E(OP_DzExpeditionEndsWarning)
E(OP_DzExpeditionInfo)
E(OP_DzExpeditionList)
E(OP_DzJoinExpeditionConfirm)
E(OP_DzLeaderStatus)
E(OP_DzExpeditionInvite)
E(OP_DzExpeditionLockoutTimers)
E(OP_DzMemberList)
E(OP_DzMemberListName)
E(OP_DzMemberListStatus)
E(OP_DzSetLeaderName)
E(OP_Emote)
E(OP_ExpansionInfo)
E(OP_FormattedMessage)
@@ -145,6 +148,12 @@ D(OP_ConsiderCorpse)
D(OP_Consume)
D(OP_Damage)
D(OP_DeleteItem)
D(OP_DzAddPlayer)
D(OP_DzChooseZoneReply)
D(OP_DzExpeditionInviteResponse)
D(OP_DzMakeLeader)
D(OP_DzRemovePlayer)
D(OP_DzSwapPlayer)
D(OP_Emote)
D(OP_EnvDamage)
D(OP_FaceChange)
+139 -28
View File
@@ -575,7 +575,11 @@ struct NewZone_Struct {
/*0848*/ int32 unknown848;
/*0852*/ uint16 zone_id;
/*0854*/ uint16 zone_instance;
/*0856*/ char unknown856[20];
/*0856*/ uint32 scriptNPCReceivedanItem;
/*0860*/ uint32 bCheck; // padded bool
/*0864*/ uint32 scriptIDSomething;
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
/*0872*/ uint32 scriptIDSomething3;
/*0876*/ uint32 SuspendBuffs;
/*0880*/ uint32 unknown880; // Seen 50
/*0884*/ uint32 unknown884; // Seen 10
@@ -4811,52 +4815,159 @@ struct VeteranClaim
/*076*/ uint32 action;
};
struct ExpeditionEntryHeader_Struct
struct ExpeditionInvite_Struct
{
/*000*/ uint32 client_id; // unique character id
/*004*/ uint32 unknown004;
/*008*/ char inviter_name[64];
/*072*/ char expedition_name[128];
/*200*/ uint8 swapping; // 0: adding 1: swapping
/*201*/ char swap_name[64]; // if swapping, swap name being removed
/*265*/ uint8 padding[3];
/*268*/ uint16 dz_zone_id; // dz_id zone/instance pair, sent back in reply
/*270*/ uint16 dz_instance_id;
};
struct ExpeditionInviteResponse_Struct
{
/*000*/ uint32 unknown000;
/*000*/ uint32 number_of_entries;
};
struct ExpeditionJoinPrompt_Struct
{
/*000*/ uint32 clientid;
/*004*/ uint32 unknown004;
/*008*/ char player_name[64];
/*072*/ char expedition_name[64];
};
struct ExpeditionExpireWarning
{
/*000*/ uint32 clientid;
/*004*/ uint32 unknown004;
/*008*/ uint32 minutes_remaining;
/*008*/ uint16 dz_zone_id; // dz_id pair sent in invite
/*010*/ uint16 dz_instance_id;
/*012*/ uint8 accepted; // 0: declined 1: accepted
/*013*/ uint8 swapping; // 0: adding 1: swapping (sent in invite)
/*014*/ char swap_name[64]; // swap name sent in invite
/*078*/ uint8 unknown078; // padding garbage?
/*079*/ uint8 unknown079; // padding garbage?
};
struct ExpeditionInfo_Struct
{
/*000*/ uint32 clientid;
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 unknown008;
/*008*/ uint32 assigned; // padded bool
/*012*/ uint32 max_players;
/*016*/ char expedition_name[128];
/*142*/ char leader_name[64];
/*016*/ char expedition_name[128];
/*144*/ char leader_name[64];
};
struct ExpeditionCompassEntry_Struct
struct ExpeditionMemberEntry_Struct
{
/*000*/ float unknown000; //seen *((uint32*)) = 1584791871
/*004*/ uint32 enabled; //guess
/*008*/ uint32 unknown008; //seen 1019
/*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
};
struct ExpeditionMemberList_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 member_count; // number of players in window
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
};
struct ExpeditionMemberListName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
/*012*/ char name[64];
};
struct ExpeditionLockoutTimerEntry_Struct
{
/*000*/ char expedition_name[1]; // variable length, null terminated, max 0x80 (128)
/*000*/ uint32 seconds_remaining;
/*000*/ int32 event_type; // seen -1 (0xffffffff) for replay timers and 1 for event timers
/*000*/ char event_name[1]; // variable length, null terminated, max 0x100 (256)
};
struct ExpeditionLockoutTimers_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
};
struct ExpeditionSetLeaderName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ char leader_name[64];
};
struct ExpeditionCommand_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ char name[64];
};
struct ExpeditionCommandSwap_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ char add_player_name[64]; // swap to (player must confirm)
/*072*/ char rem_player_name[64]; // swap from
};
struct ExpeditionExpireWarning
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 minutes_remaining;
};
struct DynamicZoneCompassEntry_Struct
{
/*000*/ uint16 dz_zone_id; // target dz id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
/*008*/ uint32 unknown008;
/*012*/ float y;
/*016*/ float x;
/*020*/ float z;
};
struct ExpeditionCompass_Struct
struct DynamicZoneCompass_Struct
{
/*000*/ uint32 clientid;
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ ExpeditionCompassEntry_Struct entries[0];
/*008*/ DynamicZoneCompassEntry_Struct entries[0];
};
struct DynamicZoneChooseZoneEntry_Struct
{
/*000*/ uint16 dz_zone_id; // dz_id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 unknown_id1; // sent back in reply
/*008*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest -- sent back in reply
/*012*/ uint32 unknown_id2; // possibly an id based on dz type, for expeditions this was same as dz_id (zone|instance) but task dz was different
/*016*/ char description[1]; // variable length, null terminated, max 0x80 (128)
/*000*/ char leader_name[1]; // variable length, null terminated, max 0x40 (64)
};
struct DynamicZoneChooseZone_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ DynamicZoneChooseZoneEntry_Struct choices[0];
};
struct DynamicZoneChooseZoneReply_Struct
{
/*000*/ uint32 unknown000; // ff ff ff ff
/*004*/ uint32 unknown004; // seen 69 00 00 00
/*008*/ uint32 unknown008; // ff ff ff ff
/*012*/ uint32 unknown_id1; // from choose zone entry message
/*016*/ uint16 dz_zone_id; // dz_id pair
/*018*/ uint16 dz_instance_id;
/*020*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest
/*024*/ uint32 unknown_id2; // from choose zone entry message
/*028*/ uint32 unknown028; // 00 00 00 00
/*032*/ uint32 unknown032; // always same as unknown044
/*036*/ uint32 unknown036;
/*040*/ uint32 unknown040;
/*044*/ uint32 unknown044; // always same as unknown032
/*048*/ uint32 unknown048; // seen 01 00 00 00 and 02 00 00 00
};
struct MaxCharacters_Struct
+180 -71
View File
@@ -483,15 +483,48 @@ namespace SoD
FINISH_ENCODE();
}
ENCODE(OP_DzChooseZone)
{
SETUP_VAR_ENCODE(DynamicZoneChooseZone_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->count);
for (uint32 i = 0; i < emu->count; ++i)
{
buf.WriteUInt16(emu->choices[i].dz_zone_id);
buf.WriteUInt16(emu->choices[i].dz_instance_id);
buf.WriteUInt32(emu->choices[i].unknown_id1);
buf.WriteUInt32(emu->choices[i].dz_type);
buf.WriteUInt32(emu->choices[i].unknown_id2);
buf.WriteString(emu->choices[i].description);
buf.WriteString(emu->choices[i].leader_name);
}
__packet->size = buf.size();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzCompass)
{
SETUP_VAR_ENCODE(ExpeditionCompass_Struct);
ALLOC_VAR_ENCODE(structs::ExpeditionCompass_Struct, sizeof(structs::ExpeditionInfo_Struct) + sizeof(structs::ExpeditionCompassEntry_Struct) * emu->count);
SETUP_VAR_ENCODE(DynamicZoneCompass_Struct);
ALLOC_VAR_ENCODE(structs::DynamicZoneCompass_Struct,
sizeof(structs::DynamicZoneCompass_Struct) +
sizeof(structs::DynamicZoneCompassEntry_Struct) * emu->count
);
OUT(client_id);
OUT(count);
for (uint32 i = 0; i < emu->count; ++i)
{
OUT(entries[i].dz_zone_id);
OUT(entries[i].dz_instance_id);
OUT(entries[i].dz_type);
OUT(entries[i].x);
OUT(entries[i].y);
OUT(entries[i].z);
@@ -515,81 +548,60 @@ namespace SoD
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
OUT(client_id);
OUT(assigned);
OUT(max_players);
eq->unknown004 = 785316192;
eq->unknown008 = 435601;
strcpy(eq->expedition_name, emu->expedition_name);
strcpy(eq->leader_name, emu->leader_name);
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionList)
ENCODE(OP_DzExpeditionInvite)
{
SETUP_VAR_ENCODE(ExpeditionLockoutList_Struct);
ENCODE_LENGTH_EXACT(ExpeditionInvite_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInvite_Struct, structs::ExpeditionInvite_Struct);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&emu->count, sizeof(uint32));
OUT(client_id);
strn0cpy(eq->inviter_name, emu->inviter_name, sizeof(eq->inviter_name));
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
OUT(swapping);
strn0cpy(eq->swap_name, emu->swap_name, sizeof(eq->swap_name));
OUT(dz_zone_id);
OUT(dz_instance_id);
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionLockoutTimers)
{
SETUP_VAR_ENCODE(ExpeditionLockoutTimers_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->count);
for (uint32 i = 0; i < emu->count; ++i)
{
ss.write(emu->entries[i].expedition, strlen(emu->entries[i].expedition));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&emu->entries[i].time_left, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write(emu->entries[i].expedition_event, strlen(emu->entries[i].expedition_event));
ss.write((const char*)&null_term, sizeof(char));
buf.WriteString(emu->timers[i].expedition_name);
buf.WriteUInt32(emu->timers[i].seconds_remaining);
buf.WriteInt32(emu->timers[i].event_type);
buf.WriteString(emu->timers[i].event_name);
}
__packet->size = ss.str().length();
__packet->size = buf.size();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzJoinExpeditionConfirm)
ENCODE(OP_DzSetLeaderName)
{
ENCODE_LENGTH_EXACT(ExpeditionJoinPrompt_Struct);
SETUP_DIRECT_ENCODE(ExpeditionJoinPrompt_Struct, structs::ExpeditionJoinPrompt_Struct);
ENCODE_LENGTH_EXACT(ExpeditionSetLeaderName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionSetLeaderName_Struct, structs::ExpeditionSetLeaderName_Struct);
strcpy(eq->expedition_name, emu->expedition_name);
strcpy(eq->player_name, emu->player_name);
FINISH_ENCODE();
}
ENCODE(OP_DzLeaderStatus)
{
SETUP_VAR_ENCODE(ExpeditionLeaderSet_Struct);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write(emu->leader_name, strlen(emu->leader_name));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));//0xffffffff
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));//1
ss.write((const char*)&client_id, sizeof(uint32));
__packet->size = ss.str().length();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
OUT(client_id);
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
FINISH_ENCODE();
}
@@ -598,26 +610,44 @@ namespace SoD
{
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&emu->count, sizeof(uint32));
for (uint32 i = 0; i < emu->count; ++i)
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->member_count);
for (uint32 i = 0; i < emu->member_count; ++i)
{
ss.write(emu->entries[i].name, strlen(emu->entries[i].name));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&emu->entries[i].status, sizeof(char));
buf.WriteString(emu->members[i].name);
buf.WriteUInt8(emu->members[i].expedition_status);
}
__packet->size = ss.str().length();
__packet->size = buf.size();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzMemberListName)
{
ENCODE_LENGTH_EXACT(ExpeditionMemberListName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionMemberListName_Struct, structs::ExpeditionMemberListName_Struct);
OUT(client_id);
OUT(add_name);
strn0cpy(eq->name, emu->name, sizeof(eq->name));
FINISH_ENCODE();
}
ENCODE(OP_DzMemberListStatus)
{
auto emu = reinterpret_cast<ExpeditionMemberList_Struct*>((*p)->pBuffer);
if (emu->member_count == 1)
{
ENCODE_FORWARD(OP_DzMemberList);
}
}
ENCODE(OP_Emote)
{
EQApplicationPacket *in = *p;
@@ -1353,6 +1383,7 @@ namespace SoD
OUT(FastRegenHP);
OUT(FastRegenMana);
OUT(FastRegenEndurance);
OUT(underworld_teleport_index);
/*fill in some unknowns with observed values, hopefully it will help */
eq->unknown800 = -1;
@@ -2973,6 +3004,84 @@ namespace SoD
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzAddPlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzChooseZoneReply)
{
DECODE_LENGTH_EXACT(structs::DynamicZoneChooseZoneReply_Struct);
SETUP_DIRECT_DECODE(DynamicZoneChooseZoneReply_Struct, structs::DynamicZoneChooseZoneReply_Struct);
IN(unknown000);
IN(unknown004);
IN(unknown008);
IN(unknown_id1);
IN(dz_zone_id);
IN(dz_instance_id);
IN(dz_type);
IN(unknown_id2);
IN(unknown028);
IN(unknown032);
IN(unknown036);
IN(unknown040);
IN(unknown044);
IN(unknown048);
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzExpeditionInviteResponse)
{
DECODE_LENGTH_EXACT(structs::ExpeditionInviteResponse_Struct);
SETUP_DIRECT_DECODE(ExpeditionInviteResponse_Struct, structs::ExpeditionInviteResponse_Struct);
IN(dz_zone_id);
IN(dz_instance_id);
IN(accepted);
IN(swapping);
strn0cpy(emu->swap_name, eq->swap_name, sizeof(emu->swap_name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzMakeLeader)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzRemovePlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzSwapPlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommandSwap_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommandSwap_Struct, structs::ExpeditionCommandSwap_Struct);
strn0cpy(emu->add_player_name, eq->add_player_name, sizeof(emu->add_player_name));
strn0cpy(emu->rem_player_name, eq->rem_player_name, sizeof(emu->rem_player_name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_Emote)
{
unsigned char *__eq_buffer = __packet->pBuffer;
+12 -3
View File
@@ -35,13 +35,16 @@ E(OP_Consider)
E(OP_Damage)
E(OP_DeleteCharge)
E(OP_DeleteItem)
E(OP_DzChooseZone)
E(OP_DzCompass)
E(OP_DzExpeditionEndsWarning)
E(OP_DzExpeditionInfo)
E(OP_DzExpeditionList)
E(OP_DzJoinExpeditionConfirm)
E(OP_DzLeaderStatus)
E(OP_DzExpeditionInvite)
E(OP_DzExpeditionLockoutTimers)
E(OP_DzMemberList)
E(OP_DzMemberListName)
E(OP_DzMemberListStatus)
E(OP_DzSetLeaderName)
E(OP_Emote)
E(OP_ExpansionInfo)
E(OP_FormattedMessage)
@@ -111,6 +114,12 @@ D(OP_Consider)
D(OP_ConsiderCorpse)
D(OP_Consume)
D(OP_DeleteItem)
D(OP_DzAddPlayer)
D(OP_DzChooseZoneReply)
D(OP_DzExpeditionInviteResponse)
D(OP_DzMakeLeader)
D(OP_DzRemovePlayer)
D(OP_DzSwapPlayer)
D(OP_Emote)
D(OP_FaceChange)
D(OP_FindPersonRequest)
+140 -28
View File
@@ -444,7 +444,11 @@ struct NewZone_Struct {
/*0848*/ int32 unknown848;
/*0852*/ uint16 zone_id;
/*0854*/ uint16 zone_instance;
/*0856*/ char unknown856[20];
/*0856*/ uint32 scriptNPCReceivedanItem;
/*0860*/ uint32 bCheck; // padded bool
/*0864*/ uint32 scriptIDSomething;
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
/*0872*/ uint32 scriptIDSomething3;
/*0876*/ uint32 SuspendBuffs;
/*0880*/ uint32 unknown880; //seen 50
/*0884*/ uint32 unknown884; //seen 10
@@ -4165,52 +4169,160 @@ struct VeteranReward
/*012*/ VeteranRewardItem items[8];
};
struct ExpeditionEntryHeader_Struct
struct ExpeditionInvite_Struct
{
/*000*/ uint32 client_id; // unique character id
/*004*/ uint32 unknown004;
/*008*/ char inviter_name[64];
/*072*/ char expedition_name[128];
/*200*/ uint8 swapping; // 0: adding 1: swapping
/*201*/ char swap_name[64]; // if swapping, swap name being removed
/*265*/ uint8 padding[3];
/*268*/ uint16 dz_zone_id; // dz_id zone/instance pair, sent back in reply
/*270*/ uint16 dz_instance_id;
};
struct ExpeditionInviteResponse_Struct
{
/*000*/ uint32 unknown000;
/*000*/ uint32 number_of_entries;
};
struct ExpeditionJoinPrompt_Struct
{
/*000*/ uint32 clientid;
/*004*/ uint32 unknown004;
/*008*/ char player_name[64];
/*072*/ char expedition_name[64];
};
struct ExpeditionExpireWarning
{
/*000*/ uint32 clientid;
/*004*/ uint32 unknown004;
/*008*/ uint32 minutes_remaining;
/*008*/ uint16 dz_zone_id; // dz_id pair sent in invite
/*010*/ uint16 dz_instance_id;
/*012*/ uint8 accepted; // 0: declined 1: accepted
/*013*/ uint8 swapping; // 0: adding 1: swapping (sent in invite)
/*014*/ char swap_name[64]; // swap name sent in invite
/*078*/ uint8 unknown078; // padding garbage?
/*079*/ uint8 unknown079; // padding garbage?
};
struct ExpeditionInfo_Struct
{
/*000*/ uint32 clientid;
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 unknown008;
/*008*/ uint32 assigned; // padded bool
/*012*/ uint32 max_players;
/*016*/ char expedition_name[128];
/*142*/ char leader_name[64];
/*016*/ char expedition_name[128];
/*144*/ char leader_name[64];
};
struct ExpeditionCompassEntry_Struct
struct ExpeditionMemberEntry_Struct
{
/*000*/ float unknown000; //seen *((uint32*)) = 1584791871
/*004*/ uint32 enabled; //guess
/*008*/ uint32 unknown008; //seen 1019
/*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
};
struct ExpeditionMemberList_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 member_count; // number of players in window
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
};
struct ExpeditionMemberListName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
/*012*/ char name[64];
};
struct ExpeditionLockoutTimerEntry_Struct
{
/*000*/ char expedition_name[1]; // variable length, null terminated, max 0x80 (128)
/*000*/ uint32 seconds_remaining;
/*000*/ int32 event_type; // seen -1 (0xffffffff) for replay timers and 1 for event timers
/*000*/ char event_name[1]; // variable length, null terminated, max 0x100 (256)
};
struct ExpeditionLockoutTimers_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
};
struct ExpeditionSetLeaderName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ char leader_name[64];
};
struct ExpeditionCommand_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ char name[64];
};
struct ExpeditionCommandSwap_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ char add_player_name[64]; // swap to (player must confirm)
/*072*/ char rem_player_name[64]; // swap from
};
struct ExpeditionExpireWarning
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 minutes_remaining;
};
struct DynamicZoneCompassEntry_Struct
{
/*000*/ uint16 dz_zone_id; // target dz id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
/*008*/ uint32 unknown008;
/*012*/ float y;
/*016*/ float x;
/*020*/ float z;
};
struct ExpeditionCompass_Struct
struct DynamicZoneCompass_Struct
{
/*000*/ uint32 clientid;
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ ExpeditionCompassEntry_Struct entries[0];
/*008*/ DynamicZoneCompassEntry_Struct entries[0];
};
struct DynamicZoneChooseZoneEntry_Struct
{
/*000*/ uint16 dz_zone_id; // dz_id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 unknown_id1; // sent back in reply
/*008*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest -- sent back in reply
/*012*/ uint32 unknown_id2; // possibly an id based on dz type, for expeditions this was same as dz_id (zone|instance) but task dz was different
/*016*/ char description[1]; // variable length, null terminated, max 0x80 (128)
/*000*/ char leader_name[1]; // variable length, null terminated, max 0x40 (64)
};
struct DynamicZoneChooseZone_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ DynamicZoneChooseZoneEntry_Struct choices[0];
};
struct DynamicZoneChooseZoneReply_Struct
{
/*000*/ uint32 unknown000; // ff ff ff ff
/*004*/ uint32 unknown004; // seen 69 00 00 00
/*008*/ uint32 unknown008; // ff ff ff ff
/*012*/ uint32 unknown_id1; // from choose zone entry message
/*016*/ uint16 dz_zone_id; // dz_id pair
/*018*/ uint16 dz_instance_id;
/*020*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest
/*024*/ uint32 unknown_id2; // from choose zone entry message
/*028*/ uint32 unknown028; // 00 00 00 00
/*032*/ uint32 unknown032; // always same as unknown044
/*036*/ uint32 unknown036;
/*040*/ uint32 unknown040;
/*044*/ uint32 unknown044; // always same as unknown032
/*048*/ uint32 unknown048; // seen 01 00 00 00 and 02 00 00 00
};
struct AltCurrencySelectItem_Struct {
+180 -71
View File
@@ -471,14 +471,48 @@ namespace SoF
FINISH_ENCODE();
}
ENCODE(OP_DzChooseZone)
{
SETUP_VAR_ENCODE(DynamicZoneChooseZone_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->count);
for (uint32 i = 0; i < emu->count; ++i)
{
buf.WriteUInt16(emu->choices[i].dz_zone_id);
buf.WriteUInt16(emu->choices[i].dz_instance_id);
buf.WriteUInt32(emu->choices[i].unknown_id1);
buf.WriteUInt32(emu->choices[i].dz_type);
buf.WriteUInt32(emu->choices[i].unknown_id2);
buf.WriteString(emu->choices[i].description);
buf.WriteString(emu->choices[i].leader_name);
}
__packet->size = buf.size();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzCompass)
{
SETUP_VAR_ENCODE(ExpeditionCompass_Struct);
ALLOC_VAR_ENCODE(structs::ExpeditionCompass_Struct, sizeof(structs::ExpeditionInfo_Struct) + sizeof(structs::ExpeditionCompassEntry_Struct) * emu->count);
SETUP_VAR_ENCODE(DynamicZoneCompass_Struct);
ALLOC_VAR_ENCODE(structs::DynamicZoneCompass_Struct,
sizeof(structs::DynamicZoneCompass_Struct) +
sizeof(structs::DynamicZoneCompassEntry_Struct) * emu->count
);
OUT(client_id);
OUT(count);
for (uint32 i = 0; i < emu->count; ++i)
{
OUT(entries[i].dz_zone_id);
OUT(entries[i].dz_instance_id);
OUT(entries[i].dz_type);
OUT(entries[i].x);
OUT(entries[i].y);
OUT(entries[i].z);
@@ -502,80 +536,60 @@ namespace SoF
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
OUT(client_id);
OUT(assigned);
OUT(max_players);
eq->enabled_max = 1;
strcpy(eq->expedition_name, emu->expedition_name);
strcpy(eq->leader_name, emu->leader_name);
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionList)
ENCODE(OP_DzExpeditionInvite)
{
SETUP_VAR_ENCODE(ExpeditionLockoutList_Struct);
ENCODE_LENGTH_EXACT(ExpeditionInvite_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInvite_Struct, structs::ExpeditionInvite_Struct);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&emu->count, sizeof(uint32));
for (int i = 0; i < emu->count; ++i)
OUT(client_id);
strn0cpy(eq->inviter_name, emu->inviter_name, sizeof(eq->inviter_name));
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
OUT(swapping);
strn0cpy(eq->swap_name, emu->swap_name, sizeof(eq->swap_name));
OUT(dz_zone_id);
OUT(dz_instance_id);
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionLockoutTimers)
{
SETUP_VAR_ENCODE(ExpeditionLockoutTimers_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->count);
for (uint32 i = 0; i < emu->count; ++i)
{
ss.write(emu->entries[i].expedition, strlen(emu->entries[i].expedition));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&emu->entries[i].time_left, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write(emu->entries[i].expedition_event, strlen(emu->entries[i].expedition_event));
ss.write((const char*)&null_term, sizeof(char));
buf.WriteString(emu->timers[i].expedition_name);
buf.WriteUInt32(emu->timers[i].seconds_remaining);
buf.WriteInt32(emu->timers[i].event_type);
buf.WriteString(emu->timers[i].event_name);
}
__packet->size = ss.str().length();
__packet->size = buf.size();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzJoinExpeditionConfirm)
ENCODE(OP_DzSetLeaderName)
{
ENCODE_LENGTH_EXACT(ExpeditionJoinPrompt_Struct);
SETUP_DIRECT_ENCODE(ExpeditionJoinPrompt_Struct, structs::ExpeditionJoinPrompt_Struct);
ENCODE_LENGTH_EXACT(ExpeditionSetLeaderName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionSetLeaderName_Struct, structs::ExpeditionSetLeaderName_Struct);
strcpy(eq->expedition_name, emu->expedition_name);
strcpy(eq->player_name, emu->player_name);
FINISH_ENCODE();
}
ENCODE(OP_DzLeaderStatus)
{
SETUP_VAR_ENCODE(ExpeditionLeaderSet_Struct);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
//ss.write((const char*)&client_id, sizeof(uint32));
ss.write(emu->leader_name, strlen(emu->leader_name));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));//0xffffffff
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));//1
ss.write((const char*)&client_id, sizeof(uint32));
__packet->size = ss.str().length();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
OUT(client_id);
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
FINISH_ENCODE();
}
@@ -584,26 +598,43 @@ namespace SoF
{
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&emu->count, sizeof(uint32));
for (uint32 i = 0; i < emu->count; ++i)
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->member_count);
for (uint32 i = 0; i < emu->member_count; ++i)
{
ss.write(emu->entries[i].name, strlen(emu->entries[i].name));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&emu->entries[i].status, sizeof(char));
buf.WriteString(emu->members[i].name);
buf.WriteUInt8(emu->members[i].expedition_status);
}
__packet->size = ss.str().length();
__packet->size = buf.size();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzMemberListName)
{
ENCODE_LENGTH_EXACT(ExpeditionMemberListName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionMemberListName_Struct, structs::ExpeditionMemberListName_Struct);
OUT(client_id);
OUT(add_name);
strn0cpy(eq->name, emu->name, sizeof(eq->name));
FINISH_ENCODE();
}
ENCODE(OP_DzMemberListStatus)
{
auto emu = reinterpret_cast<ExpeditionMemberList_Struct*>((*p)->pBuffer);
if (emu->member_count == 1)
{
ENCODE_FORWARD(OP_DzMemberList);
}
}
ENCODE(OP_Emote)
{
EQApplicationPacket *in = *p;
@@ -1030,6 +1061,7 @@ namespace SoF
OUT(FastRegenHP);
OUT(FastRegenMana);
OUT(FastRegenEndurance);
OUT(underworld_teleport_index);
/*fill in some unknowns with observed values, hopefully it will help */
eq->unknown796 = -1;
@@ -2434,6 +2466,83 @@ namespace SoF
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzAddPlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzChooseZoneReply)
{
DECODE_LENGTH_EXACT(structs::DynamicZoneChooseZoneReply_Struct);
SETUP_DIRECT_DECODE(DynamicZoneChooseZoneReply_Struct, structs::DynamicZoneChooseZoneReply_Struct);
emu->unknown000 = eq->unknown000;
emu->unknown008 = eq->unknown004;
IN(unknown_id1);
IN(dz_zone_id);
IN(dz_instance_id);
IN(dz_type);
IN(unknown_id2);
emu->unknown028 = eq->unknown024;
emu->unknown032 = eq->unknown028;
emu->unknown036 = eq->unknown032;
emu->unknown040 = eq->unknown036;
emu->unknown044 = eq->unknown040;
emu->unknown048 = eq->unknown044;
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzExpeditionInviteResponse)
{
DECODE_LENGTH_EXACT(structs::ExpeditionInviteResponse_Struct);
SETUP_DIRECT_DECODE(ExpeditionInviteResponse_Struct, structs::ExpeditionInviteResponse_Struct);
IN(dz_zone_id);
IN(dz_instance_id);
IN(accepted);
IN(swapping);
strn0cpy(emu->swap_name, eq->swap_name, sizeof(emu->swap_name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzMakeLeader)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzRemovePlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzSwapPlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommandSwap_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommandSwap_Struct, structs::ExpeditionCommandSwap_Struct);
strn0cpy(emu->add_player_name, eq->add_player_name, sizeof(emu->add_player_name));
strn0cpy(emu->rem_player_name, eq->rem_player_name, sizeof(emu->rem_player_name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_Emote)
{
unsigned char *__eq_buffer = __packet->pBuffer;
+12 -3
View File
@@ -36,13 +36,16 @@ E(OP_Damage)
E(OP_DeleteCharge)
E(OP_DeleteItem)
E(OP_DeleteSpawn)
E(OP_DzChooseZone)
E(OP_DzCompass)
E(OP_DzExpeditionEndsWarning)
E(OP_DzExpeditionInfo)
E(OP_DzExpeditionList)
E(OP_DzJoinExpeditionConfirm)
E(OP_DzLeaderStatus)
E(OP_DzExpeditionInvite)
E(OP_DzExpeditionLockoutTimers)
E(OP_DzMemberList)
E(OP_DzMemberListName)
E(OP_DzMemberListStatus)
E(OP_DzSetLeaderName)
E(OP_Emote)
E(OP_ExpansionInfo)
E(OP_FormattedMessage)
@@ -103,6 +106,12 @@ D(OP_Consider)
D(OP_ConsiderCorpse)
D(OP_Consume)
D(OP_DeleteItem)
D(OP_DzAddPlayer)
D(OP_DzChooseZoneReply)
D(OP_DzExpeditionInviteResponse)
D(OP_DzMakeLeader)
D(OP_DzRemovePlayer)
D(OP_DzSwapPlayer)
D(OP_Emote)
D(OP_FaceChange)
D(OP_FindPersonRequest)
+129 -18
View File
@@ -448,7 +448,11 @@ struct NewZone_Struct {
/*0844*/ int32 unknown844;
/*0848*/ uint16 zone_id;
/*0850*/ uint16 zone_instance;
/*0852*/ char unknown852[20];
/*0852*/ uint32 scriptNPCReceivedanItem;
/*0856*/ uint32 bCheck; // padded bool
/*0860*/ uint32 scriptIDSomething;
/*0864*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
/*0868*/ uint32 scriptIDSomething3;
/*0872*/ uint32 SuspendBuffs;
/*0876*/ uint32 unknown876; //seen 50
/*0880*/ uint32 unknown880; //seen 10
@@ -4084,43 +4088,150 @@ struct VeteranReward
/*012*/ VeteranRewardItem items[8];
};
struct ExpeditionExpireWarning
struct ExpeditionInvite_Struct
{
/*000*/ uint32 client_id;
/*004*/ char inviter_name[64];
/*068*/ char expedition_name[128];
/*196*/ uint8 swapping; // 0: adding 1: swapping
/*197*/ char swap_name[64]; // if swapping, swap name being removed
/*261*/ uint8 padding[3];
/*264*/ uint16 dz_zone_id; // dz_id zone/instance pair, sent back in reply
/*268*/ uint16 dz_instance_id;
};
struct ExpeditionInviteResponse_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 minutes_remaining;
/*004*/ uint16 dz_zone_id; // dz_id pair sent in invite
/*006*/ uint16 dz_instance_id;
/*008*/ uint8 accepted; // 0: declined 1: accepted
/*009*/ uint8 swapping; // 0: adding 1: swapping (sent in invite)
/*010*/ char swap_name[64]; // swap name sent in invite
/*074*/ uint8 unknown078; // padding/garbage?
/*075*/ uint8 unknown079; // padding/garbage?
};
struct ExpeditionInfo_Struct
{
/*000*/ uint32 clientid;
/*004*/ uint32 enabled_max;
/*000*/ uint32 client_id;
/*004*/ uint32 assigned; // padded bool
/*008*/ uint32 max_players;
/*012*/ char expedition_name[128];
/*142*/ char leader_name[64];
/*012*/ char expedition_name[128];
/*140*/ char leader_name[64];
};
struct ExpeditionCompassEntry_Struct
struct ExpeditionMemberEntry_Struct
{
/*000*/ float unknown000; //seen *((uint32*)) = 1584791871
/*004*/ uint32 enabled; //guess
/*008*/ uint32 unknown008; //seen 1019
/*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
};
struct ExpeditionMemberList_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 member_count;
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
};
struct ExpeditionMemberListName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
/*008*/ char name[64];
};
struct ExpeditionLockoutTimerEntry_Struct
{
/*000*/ char expedition_name[1]; // variable length, null terminated, max 0x80 (128)
/*000*/ uint32 seconds_remaining;
/*000*/ int32 event_type; // seen -1 (0xffffffff) for replay timers and 1 for event timers
/*000*/ char event_name[1]; // variable length, null terminated, max 0x100 (256)
};
struct ExpeditionLockoutTimers_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
};
struct ExpeditionSetLeaderName_Struct
{
/*000*/ uint32 client_id;
/*004*/ char leader_name[64];
};
struct ExpeditionCommand_Struct
{
/*000*/ uint32 unknown000;
/*004*/ char name[64];
};
struct ExpeditionCommandSwap_Struct
{
/*000*/ uint32 unknown000;
/*004*/ char add_player_name[64]; // swap to (player must confirm)
/*068*/ char rem_player_name[64]; // swap from
};
struct ExpeditionExpireWarning
{
/*000*/ uint32 client_id;
/*004*/ uint32 minutes_remaining;
};
struct DynamicZoneCompassEntry_Struct
{
/*000*/ uint16 dz_zone_id; // target dz id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
/*008*/ uint32 unknown008;
/*012*/ float y;
/*016*/ float x;
/*020*/ float z;
};
struct ExpeditionCompass_Struct
struct DynamicZoneCompass_Struct
{
/*000*/ uint32 clientid;
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ ExpeditionCompassEntry_Struct entries[0];
/*008*/ DynamicZoneCompassEntry_Struct entries[0];
};
struct ExpeditionJoinPrompt_Struct
struct DynamicZoneChooseZoneEntry_Struct
{
/*000*/ uint32 clientid;
/*004*/ char player_name[64];
/*068*/ char expedition_name[64];
/*000*/ uint16 dz_zone_id; // dz_id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 unknown_id1; // sent back in reply
/*008*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest -- sent back in reply
/*012*/ uint32 unknown_id2; // possibly an id based on dz type, for expeditions this was same as dz_id (zone|instance) but task dz was different
/*016*/ char description[1]; // variable length, null terminated, max 0x80 (128)
/*000*/ char leader_name[1]; // variable length, null terminated, max 0x40 (64)
};
struct DynamicZoneChooseZone_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ DynamicZoneChooseZoneEntry_Struct choices[0];
};
struct DynamicZoneChooseZoneReply_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ uint32 unknown_id1;
/*012*/ uint16 dz_zone_id;
/*014*/ uint16 dz_instance_id;
/*016*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest
/*020*/ uint32 unknown_id2;
/*024*/ uint32 unknown024;
/*028*/ uint32 unknown028; // always same as unknown040
/*032*/ uint32 unknown032;
/*036*/ uint32 unknown036;
/*040*/ uint32 unknown040; // always same as unknown028
/*044*/ uint32 unknown044;
};
struct AltCurrencySelectItem_Struct {
+177 -70
View File
@@ -414,15 +414,48 @@ namespace Titanium
FINISH_ENCODE();
}
ENCODE(OP_DzChooseZone)
{
SETUP_VAR_ENCODE(DynamicZoneChooseZone_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->count);
for (uint32 i = 0; i < emu->count; ++i)
{
buf.WriteUInt16(emu->choices[i].dz_zone_id);
buf.WriteUInt16(emu->choices[i].dz_instance_id);
buf.WriteUInt32(emu->choices[i].unknown_id1);
buf.WriteUInt32(emu->choices[i].dz_type);
buf.WriteUInt32(emu->choices[i].unknown_id2);
buf.WriteString(emu->choices[i].description);
buf.WriteString(emu->choices[i].leader_name);
}
__packet->size = buf.size();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzCompass)
{
SETUP_VAR_ENCODE(ExpeditionCompass_Struct);
ALLOC_VAR_ENCODE(structs::ExpeditionCompass_Struct, sizeof(structs::ExpeditionInfo_Struct) + sizeof(structs::ExpeditionCompassEntry_Struct) * emu->count);
SETUP_VAR_ENCODE(DynamicZoneCompass_Struct);
ALLOC_VAR_ENCODE(structs::DynamicZoneCompass_Struct,
sizeof(structs::DynamicZoneCompass_Struct) +
sizeof(structs::DynamicZoneCompassEntry_Struct) * emu->count
);
OUT(client_id);
OUT(count);
for (uint32 i = 0; i < emu->count; ++i)
{
OUT(entries[i].dz_zone_id);
OUT(entries[i].dz_instance_id);
OUT(entries[i].dz_type);
OUT(entries[i].x);
OUT(entries[i].y);
OUT(entries[i].z);
@@ -446,80 +479,60 @@ namespace Titanium
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
OUT(client_id);
OUT(assigned);
OUT(max_players);
eq->enabled_max = 1;
strcpy(eq->expedition_name, emu->expedition_name);
strcpy(eq->leader_name, emu->leader_name);
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionList)
ENCODE(OP_DzExpeditionInvite)
{
SETUP_VAR_ENCODE(ExpeditionLockoutList_Struct);
ENCODE_LENGTH_EXACT(ExpeditionInvite_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInvite_Struct, structs::ExpeditionInvite_Struct);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&emu->count, sizeof(uint32));
OUT(client_id);
strn0cpy(eq->inviter_name, emu->inviter_name, sizeof(eq->inviter_name));
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
OUT(swapping);
strn0cpy(eq->swap_name, emu->swap_name, sizeof(eq->swap_name));
OUT(dz_zone_id);
OUT(dz_instance_id);
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionLockoutTimers)
{
SETUP_VAR_ENCODE(ExpeditionLockoutTimers_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->count);
for (uint32 i = 0; i < emu->count; ++i)
{
ss.write(emu->entries[i].expedition, strlen(emu->entries[i].expedition));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&emu->entries[i].time_left, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write(emu->entries[i].expedition_event, strlen(emu->entries[i].expedition_event));
ss.write((const char*)&null_term, sizeof(char));
buf.WriteString(emu->timers[i].expedition_name);
buf.WriteUInt32(emu->timers[i].seconds_remaining);
buf.WriteInt32(emu->timers[i].event_type);
buf.WriteString(emu->timers[i].event_name);
}
__packet->size = ss.str().length();
__packet->size = buf.size();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzJoinExpeditionConfirm)
ENCODE(OP_DzSetLeaderName)
{
ENCODE_LENGTH_EXACT(ExpeditionJoinPrompt_Struct);
SETUP_DIRECT_ENCODE(ExpeditionJoinPrompt_Struct, structs::ExpeditionJoinPrompt_Struct);
ENCODE_LENGTH_EXACT(ExpeditionSetLeaderName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionSetLeaderName_Struct, structs::ExpeditionSetLeaderName_Struct);
strcpy(eq->expedition_name, emu->expedition_name);
strcpy(eq->player_name, emu->player_name);
FINISH_ENCODE();
}
ENCODE(OP_DzLeaderStatus)
{
SETUP_VAR_ENCODE(ExpeditionLeaderSet_Struct);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
//ss.write((const char*)&client_id, sizeof(uint32));
ss.write(emu->leader_name, strlen(emu->leader_name));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));//0xffffffff
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));//1
ss.write((const char*)&client_id, sizeof(uint32));
__packet->size = ss.str().length();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
OUT(client_id);
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
FINISH_ENCODE();
}
@@ -528,26 +541,43 @@ namespace Titanium
{
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&emu->count, sizeof(uint32));
for (uint32 i = 0; i < emu->count; ++i)
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->member_count);
for (uint32 i = 0; i < emu->member_count; ++i)
{
ss.write(emu->entries[i].name, strlen(emu->entries[i].name));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&emu->entries[i].status, sizeof(char));
buf.WriteString(emu->members[i].name);
buf.WriteUInt8(emu->members[i].expedition_status);
}
__packet->size = ss.str().length();
__packet->size = buf.size();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzMemberListName)
{
ENCODE_LENGTH_EXACT(ExpeditionMemberListName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionMemberListName_Struct, structs::ExpeditionMemberListName_Struct);
OUT(client_id);
OUT(add_name);
strn0cpy(eq->name, emu->name, sizeof(eq->name));
FINISH_ENCODE();
}
ENCODE(OP_DzMemberListStatus)
{
auto emu = reinterpret_cast<ExpeditionMemberList_Struct*>((*p)->pBuffer);
if (emu->member_count == 1)
{
ENCODE_FORWARD(OP_DzMemberList);
}
}
ENCODE(OP_Emote)
{
EQApplicationPacket *in = *p;
@@ -1943,6 +1973,83 @@ namespace Titanium
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzAddPlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzChooseZoneReply)
{
DECODE_LENGTH_EXACT(structs::DynamicZoneChooseZoneReply_Struct);
SETUP_DIRECT_DECODE(DynamicZoneChooseZoneReply_Struct, structs::DynamicZoneChooseZoneReply_Struct);
emu->unknown000 = eq->unknown000;
emu->unknown008 = eq->unknown004;
IN(unknown_id1);
IN(dz_zone_id);
IN(dz_instance_id);
IN(dz_type);
IN(unknown_id2);
emu->unknown028 = eq->unknown024;
emu->unknown032 = eq->unknown028;
emu->unknown036 = eq->unknown032;
emu->unknown040 = eq->unknown036;
emu->unknown044 = eq->unknown040;
emu->unknown048 = eq->unknown044;
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzExpeditionInviteResponse)
{
DECODE_LENGTH_EXACT(structs::ExpeditionInviteResponse_Struct);
SETUP_DIRECT_DECODE(ExpeditionInviteResponse_Struct, structs::ExpeditionInviteResponse_Struct);
IN(dz_zone_id);
IN(dz_instance_id);
IN(accepted);
IN(swapping);
strn0cpy(emu->swap_name, eq->swap_name, sizeof(emu->swap_name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzMakeLeader)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzRemovePlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzSwapPlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommandSwap_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommandSwap_Struct, structs::ExpeditionCommandSwap_Struct);
strn0cpy(emu->add_player_name, eq->add_player_name, sizeof(emu->add_player_name));
strn0cpy(emu->rem_player_name, eq->rem_player_name, sizeof(emu->rem_player_name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_Emote)
{
unsigned char *__eq_buffer = __packet->pBuffer;
+12 -3
View File
@@ -32,13 +32,16 @@ E(OP_Damage)
E(OP_DeleteCharge)
E(OP_DeleteItem)
E(OP_DeleteSpawn)
E(OP_DzChooseZone)
E(OP_DzCompass)
E(OP_DzExpeditionEndsWarning)
E(OP_DzExpeditionInfo)
E(OP_DzExpeditionList)
E(OP_DzJoinExpeditionConfirm)
E(OP_DzLeaderStatus)
E(OP_DzExpeditionInvite)
E(OP_DzExpeditionLockoutTimers)
E(OP_DzMemberList)
E(OP_DzMemberListName)
E(OP_DzMemberListStatus)
E(OP_DzSetLeaderName)
E(OP_Emote)
E(OP_FormattedMessage)
E(OP_GroundSpawn)
@@ -86,6 +89,12 @@ D(OP_CharacterCreate)
D(OP_ClientUpdate)
D(OP_Consume)
D(OP_DeleteItem)
D(OP_DzAddPlayer)
D(OP_DzChooseZoneReply)
D(OP_DzExpeditionInviteResponse)
D(OP_DzMakeLeader)
D(OP_DzRemovePlayer)
D(OP_DzSwapPlayer)
D(OP_Emote)
D(OP_FaceChange)
D(OP_InspectAnswer)
+124 -17
View File
@@ -3299,43 +3299,150 @@ struct VeteranReward
/*004*/ VeteranRewardItem item;
};
struct ExpeditionExpireWarning
struct ExpeditionInvite_Struct
{
/*000*/ uint32 client_id;
/*004*/ char inviter_name[64];
/*068*/ char expedition_name[128];
/*196*/ uint8 swapping; // 0: adding 1: swapping
/*197*/ char swap_name[64]; // if swapping, swap name being removed
/*261*/ uint8 padding[3];
/*264*/ uint16 dz_zone_id; // dz_id zone/instance pair, sent back in reply
/*268*/ uint16 dz_instance_id;
};
struct ExpeditionInviteResponse_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 minutes_remaining;
/*004*/ uint16 dz_zone_id; // dz_id pair sent in invite
/*006*/ uint16 dz_instance_id;
/*008*/ uint8 accepted; // 0: declined 1: accepted
/*009*/ uint8 swapping; // 0: adding 1: swapping (sent in invite)
/*010*/ char swap_name[64]; // swap name sent in invite
/*074*/ uint8 unknown078; // padding/garbage?
/*075*/ uint8 unknown079; // padding/garbage?
};
struct ExpeditionInfo_Struct
{
/*000*/ uint32 clientid;
/*004*/ uint32 enabled_max;
/*000*/ uint32 client_id;
/*004*/ uint32 assigned; // padded bool
/*008*/ uint32 max_players;
/*012*/ char expedition_name[128];
/*142*/ char leader_name[64];
/*012*/ char expedition_name[128];
/*140*/ char leader_name[64];
};
struct ExpeditionCompassEntry_Struct
struct ExpeditionMemberEntry_Struct
{
/*000*/ float unknown000; //seen *((uint32*)) = 1584791871
/*004*/ uint32 enabled; //guess
/*008*/ uint32 unknown008; //seen 1019
/*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
};
struct ExpeditionMemberList_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 member_count;
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
};
struct ExpeditionMemberListName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
/*008*/ char name[64];
};
struct ExpeditionLockoutTimerEntry_Struct
{
/*000*/ char expedition_name[1]; // variable length, null terminated, max 0x80 (128)
/*000*/ uint32 seconds_remaining;
/*000*/ int32 event_type; // seen -1 (0xffffffff) for replay timers and 1 for event timers
/*000*/ char event_name[1]; // variable length, null terminated, max 0x100 (256)
};
struct ExpeditionLockoutTimers_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
};
struct ExpeditionSetLeaderName_Struct
{
/*000*/ uint32 client_id;
/*004*/ char leader_name[64];
};
struct ExpeditionCommand_Struct
{
/*000*/ uint32 unknown000;
/*004*/ char name[64];
};
struct ExpeditionCommandSwap_Struct
{
/*000*/ uint32 unknown000;
/*004*/ char add_player_name[64]; // swap to (player must confirm)
/*068*/ char rem_player_name[64]; // swap from
};
struct ExpeditionExpireWarning
{
/*000*/ uint32 client_id;
/*004*/ uint32 minutes_remaining;
};
struct DynamicZoneCompassEntry_Struct
{
/*000*/ uint16 dz_zone_id; // target dz id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
/*008*/ uint32 unknown008;
/*012*/ float y;
/*016*/ float x;
/*020*/ float z;
};
struct ExpeditionCompass_Struct
struct DynamicZoneCompass_Struct
{
/*000*/ uint32 clientid;
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ ExpeditionCompassEntry_Struct entries[0];
/*008*/ DynamicZoneCompassEntry_Struct entries[0];
};
struct ExpeditionJoinPrompt_Struct
struct DynamicZoneChooseZoneEntry_Struct
{
/*000*/ uint32 clientid;
/*004*/ char player_name[64];
/*068*/ char expedition_name[64];
/*000*/ uint16 dz_zone_id; // dz_id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 unknown_id1; // sent back in reply
/*008*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest -- sent back in reply
/*012*/ uint32 unknown_id2; // possibly an id based on dz type, for expeditions this was same as dz_id (zone|instance) but task dz was different
/*016*/ char description[1]; // variable length, null terminated, max 0x80 (128)
/*000*/ char leader_name[1]; // variable length, null terminated, max 0x40 (64)
};
struct DynamicZoneChooseZone_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ DynamicZoneChooseZoneEntry_Struct choices[0];
};
struct DynamicZoneChooseZoneReply_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ uint32 unknown_id1;
/*012*/ uint16 dz_zone_id;
/*014*/ uint16 dz_instance_id;
/*016*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest
/*020*/ uint32 unknown_id2;
/*024*/ uint32 unknown024;
/*028*/ uint32 unknown028; // always same as unknown040
/*032*/ uint32 unknown032;
/*036*/ uint32 unknown036;
/*040*/ uint32 unknown040; // always same as unknown028
/*044*/ uint32 unknown044;
};
struct LFGuild_SearchPlayer_Struct
+180 -71
View File
@@ -613,14 +613,48 @@ namespace UF
FINISH_ENCODE();
}
ENCODE(OP_DzChooseZone)
{
SETUP_VAR_ENCODE(DynamicZoneChooseZone_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->count);
for (uint32 i = 0; i < emu->count; ++i)
{
buf.WriteUInt16(emu->choices[i].dz_zone_id);
buf.WriteUInt16(emu->choices[i].dz_instance_id);
buf.WriteUInt32(emu->choices[i].unknown_id1);
buf.WriteUInt32(emu->choices[i].dz_type);
buf.WriteUInt32(emu->choices[i].unknown_id2);
buf.WriteString(emu->choices[i].description);
buf.WriteString(emu->choices[i].leader_name);
}
__packet->size = buf.size();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzCompass)
{
SETUP_VAR_ENCODE(ExpeditionCompass_Struct);
ALLOC_VAR_ENCODE(structs::ExpeditionCompass_Struct, sizeof(structs::ExpeditionInfo_Struct) + sizeof(structs::ExpeditionCompassEntry_Struct) * emu->count);
SETUP_VAR_ENCODE(DynamicZoneCompass_Struct);
ALLOC_VAR_ENCODE(structs::DynamicZoneCompass_Struct,
sizeof(structs::DynamicZoneCompass_Struct) +
sizeof(structs::DynamicZoneCompassEntry_Struct) * emu->count
);
OUT(client_id);
OUT(count);
for (uint32 i = 0; i < emu->count; ++i)
{
OUT(entries[i].dz_zone_id);
OUT(entries[i].dz_instance_id);
OUT(entries[i].dz_type);
OUT(entries[i].x);
OUT(entries[i].y);
OUT(entries[i].z);
@@ -644,81 +678,60 @@ namespace UF
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
OUT(client_id);
OUT(assigned);
OUT(max_players);
eq->unknown004 = 785316192;
eq->unknown008 = 435601;
strcpy(eq->expedition_name, emu->expedition_name);
strcpy(eq->leader_name, emu->leader_name);
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionList)
ENCODE(OP_DzExpeditionInvite)
{
SETUP_VAR_ENCODE(ExpeditionLockoutList_Struct);
ENCODE_LENGTH_EXACT(ExpeditionInvite_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInvite_Struct, structs::ExpeditionInvite_Struct);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&emu->count, sizeof(uint32));
OUT(client_id);
strn0cpy(eq->inviter_name, emu->inviter_name, sizeof(eq->inviter_name));
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
OUT(swapping);
strn0cpy(eq->swap_name, emu->swap_name, sizeof(eq->swap_name));
OUT(dz_zone_id);
OUT(dz_instance_id);
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionLockoutTimers)
{
SETUP_VAR_ENCODE(ExpeditionLockoutTimers_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->count);
for (uint32 i = 0; i < emu->count; ++i)
{
ss.write(emu->entries[i].expedition, strlen(emu->entries[i].expedition));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&emu->entries[i].time_left, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write(emu->entries[i].expedition_event, strlen(emu->entries[i].expedition_event));
ss.write((const char*)&null_term, sizeof(char));
buf.WriteString(emu->timers[i].expedition_name);
buf.WriteUInt32(emu->timers[i].seconds_remaining);
buf.WriteInt32(emu->timers[i].event_type);
buf.WriteString(emu->timers[i].event_name);
}
__packet->size = ss.str().length();
__packet->size = buf.size();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzJoinExpeditionConfirm)
ENCODE(OP_DzSetLeaderName)
{
ENCODE_LENGTH_EXACT(ExpeditionJoinPrompt_Struct);
SETUP_DIRECT_ENCODE(ExpeditionJoinPrompt_Struct, structs::ExpeditionJoinPrompt_Struct);
ENCODE_LENGTH_EXACT(ExpeditionSetLeaderName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionSetLeaderName_Struct, structs::ExpeditionSetLeaderName_Struct);
strcpy(eq->expedition_name, emu->expedition_name);
strcpy(eq->player_name, emu->player_name);
FINISH_ENCODE();
}
ENCODE(OP_DzLeaderStatus)
{
SETUP_VAR_ENCODE(ExpeditionLeaderSet_Struct);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write(emu->leader_name, strlen(emu->leader_name));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));//0xffffffff
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));//1
ss.write((const char*)&client_id, sizeof(uint32));
__packet->size = ss.str().length();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
OUT(client_id);
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
FINISH_ENCODE();
}
@@ -727,26 +740,43 @@ namespace UF
{
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&emu->count, sizeof(uint32));
for (uint32 i = 0; i < emu->count; ++i)
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->member_count);
for (uint32 i = 0; i < emu->member_count; ++i)
{
ss.write(emu->entries[i].name, strlen(emu->entries[i].name));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&emu->entries[i].status, sizeof(char));
buf.WriteString(emu->members[i].name);
buf.WriteUInt8(emu->members[i].expedition_status);
}
__packet->size = ss.str().length();
__packet->size = buf.size();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzMemberListName)
{
ENCODE_LENGTH_EXACT(ExpeditionMemberListName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionMemberListName_Struct, structs::ExpeditionMemberListName_Struct);
OUT(client_id);
OUT(add_name);
strn0cpy(eq->name, emu->name, sizeof(eq->name));
FINISH_ENCODE();
}
ENCODE(OP_DzMemberListStatus)
{
auto emu = reinterpret_cast<ExpeditionMemberList_Struct*>((*p)->pBuffer);
if (emu->member_count == 1)
{
ENCODE_FORWARD(OP_DzMemberList);
}
}
ENCODE(OP_Emote)
{
EQApplicationPacket *in = *p;
@@ -1577,6 +1607,7 @@ namespace UF
OUT(FastRegenHP);
OUT(FastRegenMana);
OUT(FastRegenEndurance);
OUT(underworld_teleport_index);
eq->FogDensity = emu->fog_density;
@@ -3314,6 +3345,84 @@ namespace UF
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzAddPlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzChooseZoneReply)
{
DECODE_LENGTH_EXACT(structs::DynamicZoneChooseZoneReply_Struct);
SETUP_DIRECT_DECODE(DynamicZoneChooseZoneReply_Struct, structs::DynamicZoneChooseZoneReply_Struct);
IN(unknown000);
IN(unknown004);
IN(unknown008);
IN(unknown_id1);
IN(dz_zone_id);
IN(dz_instance_id);
IN(dz_type);
IN(unknown_id2);
IN(unknown028);
IN(unknown032);
IN(unknown036);
IN(unknown040);
IN(unknown044);
IN(unknown048);
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzExpeditionInviteResponse)
{
DECODE_LENGTH_EXACT(structs::ExpeditionInviteResponse_Struct);
SETUP_DIRECT_DECODE(ExpeditionInviteResponse_Struct, structs::ExpeditionInviteResponse_Struct);
IN(dz_zone_id);
IN(dz_instance_id);
IN(accepted);
IN(swapping);
strn0cpy(emu->swap_name, eq->swap_name, sizeof(emu->swap_name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzMakeLeader)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzRemovePlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzSwapPlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommandSwap_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommandSwap_Struct, structs::ExpeditionCommandSwap_Struct);
strn0cpy(emu->add_player_name, eq->add_player_name, sizeof(emu->add_player_name));
strn0cpy(emu->rem_player_name, eq->rem_player_name, sizeof(emu->rem_player_name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_Emote)
{
unsigned char *__eq_buffer = __packet->pBuffer;
+12 -3
View File
@@ -38,13 +38,16 @@ E(OP_Damage)
E(OP_DeleteCharge)
E(OP_DeleteItem)
E(OP_DisciplineUpdate)
E(OP_DzChooseZone)
E(OP_DzCompass)
E(OP_DzExpeditionEndsWarning)
E(OP_DzExpeditionInfo)
E(OP_DzExpeditionList)
E(OP_DzJoinExpeditionConfirm)
E(OP_DzLeaderStatus)
E(OP_DzExpeditionInvite)
E(OP_DzExpeditionLockoutTimers)
E(OP_DzMemberList)
E(OP_DzMemberListName)
E(OP_DzMemberListStatus)
E(OP_DzSetLeaderName)
E(OP_Emote)
E(OP_ExpansionInfo)
E(OP_FormattedMessage)
@@ -120,6 +123,12 @@ D(OP_ConsiderCorpse)
D(OP_Consume)
D(OP_Damage)
D(OP_DeleteItem)
D(OP_DzAddPlayer)
D(OP_DzChooseZoneReply)
D(OP_DzExpeditionInviteResponse)
D(OP_DzMakeLeader)
D(OP_DzRemovePlayer)
D(OP_DzSwapPlayer)
D(OP_Emote)
D(OP_EnvDamage)
D(OP_FaceChange)
+140 -28
View File
@@ -444,7 +444,11 @@ struct NewZone_Struct {
/*0848*/ int32 unknown848;
/*0852*/ uint16 zone_id;
/*0854*/ uint16 zone_instance;
/*0856*/ char unknown856[20];
/*0856*/ uint32 scriptNPCReceivedanItem;
/*0860*/ uint32 bCheck; // padded bool
/*0864*/ uint32 scriptIDSomething;
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
/*0872*/ uint32 scriptIDSomething3;
/*0876*/ uint32 SuspendBuffs;
/*0880*/ uint32 unknown880; //seen 50
/*0884*/ uint32 unknown884; //seen 10
@@ -4246,52 +4250,160 @@ struct VeteranReward
/*012*/ VeteranRewardItem items[8];
};
struct ExpeditionEntryHeader_Struct
struct ExpeditionInvite_Struct
{
/*000*/ uint32 client_id; // unique character id
/*004*/ uint32 unknown004;
/*008*/ char inviter_name[64];
/*072*/ char expedition_name[128];
/*200*/ uint8 swapping; // 0: adding 1: swapping
/*201*/ char swap_name[64]; // if swapping, swap name being removed
/*265*/ uint8 padding[3];
/*268*/ uint16 dz_zone_id; // dz_id zone/instance pair, sent back in reply
/*270*/ uint16 dz_instance_id;
};
struct ExpeditionInviteResponse_Struct
{
/*000*/ uint32 unknown000;
/*000*/ uint32 number_of_entries;
};
struct ExpeditionJoinPrompt_Struct
{
/*000*/ uint32 clientid;
/*004*/ uint32 unknown004;
/*008*/ char player_name[64];
/*072*/ char expedition_name[64];
};
struct ExpeditionExpireWarning
{
/*000*/ uint32 clientid;
/*004*/ uint32 unknown004;
/*008*/ uint32 minutes_remaining;
/*008*/ uint16 dz_zone_id; // dz_id pair sent in invite
/*010*/ uint16 dz_instance_id;
/*012*/ uint8 accepted; // 0: declined 1: accepted
/*013*/ uint8 swapping; // 0: adding 1: swapping (sent in invite)
/*014*/ char swap_name[64]; // swap name sent in invite
/*078*/ uint8 unknown078; // padding garbage?
/*079*/ uint8 unknown079; // padding garbage?
};
struct ExpeditionInfo_Struct
{
/*000*/ uint32 clientid;
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 unknown008;
/*008*/ uint32 assigned; // padded bool
/*012*/ uint32 max_players;
/*016*/ char expedition_name[128];
/*142*/ char leader_name[64];
/*016*/ char expedition_name[128];
/*144*/ char leader_name[64];
};
struct ExpeditionCompassEntry_Struct
struct ExpeditionMemberEntry_Struct
{
/*000*/ float unknown000; //seen *((uint32*)) = 1584791871
/*004*/ uint32 enabled; //guess
/*008*/ uint32 unknown008; //seen 1019
/*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
};
struct ExpeditionMemberList_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 member_count; // number of players in window
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
};
struct ExpeditionMemberListName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
/*012*/ char name[64];
};
struct ExpeditionLockoutTimerEntry_Struct
{
/*000*/ char expedition_name[1]; // variable length, null terminated, max 0x80 (128)
/*000*/ uint32 seconds_remaining;
/*000*/ int32 event_type; // seen -1 (0xffffffff) for replay timers and 1 for event timers
/*000*/ char event_name[1]; // variable length, null terminated, max 0x100 (256)
};
struct ExpeditionLockoutTimers_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
};
struct ExpeditionSetLeaderName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ char leader_name[64];
};
struct ExpeditionCommand_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ char name[64];
};
struct ExpeditionCommandSwap_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ char add_player_name[64]; // swap to (player must confirm)
/*072*/ char rem_player_name[64]; // swap from
};
struct ExpeditionExpireWarning
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 minutes_remaining;
};
struct DynamicZoneCompassEntry_Struct
{
/*000*/ uint16 dz_zone_id; // target dz id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
/*008*/ uint32 unknown008;
/*012*/ float y;
/*016*/ float x;
/*020*/ float z;
};
struct ExpeditionCompass_Struct
struct DynamicZoneCompass_Struct
{
/*000*/ uint32 clientid;
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ ExpeditionCompassEntry_Struct entries[0];
/*008*/ DynamicZoneCompassEntry_Struct entries[0];
};
struct DynamicZoneChooseZoneEntry_Struct
{
/*000*/ uint16 dz_zone_id; // dz_id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 unknown_id1; // sent back in reply
/*008*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest -- sent back in reply
/*012*/ uint32 unknown_id2; // possibly an id based on dz type, for expeditions this was same as dz_id (zone|instance) but task dz was different
/*016*/ char description[1]; // variable length, null terminated, max 0x80 (128)
/*000*/ char leader_name[1]; // variable length, null terminated, max 0x40 (64)
};
struct DynamicZoneChooseZone_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ DynamicZoneChooseZoneEntry_Struct choices[0];
};
struct DynamicZoneChooseZoneReply_Struct
{
/*000*/ uint32 unknown000; // ff ff ff ff
/*004*/ uint32 unknown004; // seen 69 00 00 00
/*008*/ uint32 unknown008; // ff ff ff ff
/*012*/ uint32 unknown_id1; // from choose zone entry message
/*016*/ uint16 dz_zone_id; // dz_id pair
/*018*/ uint16 dz_instance_id;
/*020*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest
/*024*/ uint32 unknown_id2; // from choose zone entry message
/*028*/ uint32 unknown028; // 00 00 00 00
/*032*/ uint32 unknown032; // always same as unknown044
/*036*/ uint32 unknown036;
/*040*/ uint32 unknown040;
/*044*/ uint32 unknown044; // always same as unknown032
/*048*/ uint32 unknown048; // seen 01 00 00 00 and 02 00 00 00
};
struct AltCurrencySelectItem_Struct {
@@ -0,0 +1,70 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_AA_ABILITY_REPOSITORY_H
#define EQEMU_AA_ABILITY_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_aa_ability_repository.h"
class AaAbilityRepository: public BaseAaAbilityRepository {
public:
/**
* This file was auto generated and can be modified and extended upon
*
* Base repository methods are automatically
* generated in the "base" version of this repository. The base repository
* is immutable and to be left untouched, while methods in this class
* are used as extension methods for more specific persistence-layer
* accessors or mutators.
*
* Base Methods (Subject to be expanded upon in time)
*
* Note: Not all tables are designed appropriately to fit functionality with all base methods
*
* InsertOne
* UpdateOne
* DeleteOne
* FindOne
* GetWhere(std::string where_filter)
* DeleteWhere(std::string where_filter)
* InsertMany
* All
*
* Example custom methods in a repository
*
* AaAbilityRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AaAbilityRepository::GetWhereNeverExpires()
* AaAbilityRepository::GetWhereXAndY()
* AaAbilityRepository::DeleteWhereXAndY()
*
* Most of the above could be covered by base methods, but if you as a developer
* find yourself re-using logic for other parts of the code, its best to just make a
* method that can be re-used easily elsewhere especially if it can use a base repository
* method and encapsulate filters there
*/
// Custom extended repository methods here
};
#endif //EQEMU_AA_ABILITY_REPOSITORY_H
@@ -0,0 +1,70 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_AA_RANK_EFFECTS_REPOSITORY_H
#define EQEMU_AA_RANK_EFFECTS_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_aa_rank_effects_repository.h"
class AaRankEffectsRepository: public BaseAaRankEffectsRepository {
public:
/**
* This file was auto generated and can be modified and extended upon
*
* Base repository methods are automatically
* generated in the "base" version of this repository. The base repository
* is immutable and to be left untouched, while methods in this class
* are used as extension methods for more specific persistence-layer
* accessors or mutators.
*
* Base Methods (Subject to be expanded upon in time)
*
* Note: Not all tables are designed appropriately to fit functionality with all base methods
*
* InsertOne
* UpdateOne
* DeleteOne
* FindOne
* GetWhere(std::string where_filter)
* DeleteWhere(std::string where_filter)
* InsertMany
* All
*
* Example custom methods in a repository
*
* AaRankEffectsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AaRankEffectsRepository::GetWhereNeverExpires()
* AaRankEffectsRepository::GetWhereXAndY()
* AaRankEffectsRepository::DeleteWhereXAndY()
*
* Most of the above could be covered by base methods, but if you as a developer
* find yourself re-using logic for other parts of the code, its best to just make a
* method that can be re-used easily elsewhere especially if it can use a base repository
* method and encapsulate filters there
*/
// Custom extended repository methods here
};
#endif //EQEMU_AA_RANK_EFFECTS_REPOSITORY_H
@@ -0,0 +1,70 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_AA_RANK_PREREQS_REPOSITORY_H
#define EQEMU_AA_RANK_PREREQS_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_aa_rank_prereqs_repository.h"
class AaRankPrereqsRepository: public BaseAaRankPrereqsRepository {
public:
/**
* This file was auto generated and can be modified and extended upon
*
* Base repository methods are automatically
* generated in the "base" version of this repository. The base repository
* is immutable and to be left untouched, while methods in this class
* are used as extension methods for more specific persistence-layer
* accessors or mutators.
*
* Base Methods (Subject to be expanded upon in time)
*
* Note: Not all tables are designed appropriately to fit functionality with all base methods
*
* InsertOne
* UpdateOne
* DeleteOne
* FindOne
* GetWhere(std::string where_filter)
* DeleteWhere(std::string where_filter)
* InsertMany
* All
*
* Example custom methods in a repository
*
* AaRankPrereqsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AaRankPrereqsRepository::GetWhereNeverExpires()
* AaRankPrereqsRepository::GetWhereXAndY()
* AaRankPrereqsRepository::DeleteWhereXAndY()
*
* Most of the above could be covered by base methods, but if you as a developer
* find yourself re-using logic for other parts of the code, its best to just make a
* method that can be re-used easily elsewhere especially if it can use a base repository
* method and encapsulate filters there
*/
// Custom extended repository methods here
};
#endif //EQEMU_AA_RANK_PREREQS_REPOSITORY_H
+70
View File
@@ -0,0 +1,70 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_AA_RANKS_REPOSITORY_H
#define EQEMU_AA_RANKS_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_aa_ranks_repository.h"
class AaRanksRepository: public BaseAaRanksRepository {
public:
/**
* This file was auto generated and can be modified and extended upon
*
* Base repository methods are automatically
* generated in the "base" version of this repository. The base repository
* is immutable and to be left untouched, while methods in this class
* are used as extension methods for more specific persistence-layer
* accessors or mutators.
*
* Base Methods (Subject to be expanded upon in time)
*
* Note: Not all tables are designed appropriately to fit functionality with all base methods
*
* InsertOne
* UpdateOne
* DeleteOne
* FindOne
* GetWhere(std::string where_filter)
* DeleteWhere(std::string where_filter)
* InsertMany
* All
*
* Example custom methods in a repository
*
* AaRanksRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AaRanksRepository::GetWhereNeverExpires()
* AaRanksRepository::GetWhereXAndY()
* AaRanksRepository::DeleteWhereXAndY()
*
* Most of the above could be covered by base methods, but if you as a developer
* find yourself re-using logic for other parts of the code, its best to just make a
* method that can be re-used easily elsewhere especially if it can use a base repository
* method and encapsulate filters there
*/
// Custom extended repository methods here
};
#endif //EQEMU_AA_RANKS_REPOSITORY_H
@@ -0,0 +1,70 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_ACCOUNT_FLAGS_REPOSITORY_H
#define EQEMU_ACCOUNT_FLAGS_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_account_flags_repository.h"
class AccountFlagsRepository: public BaseAccountFlagsRepository {
public:
/**
* This file was auto generated and can be modified and extended upon
*
* Base repository methods are automatically
* generated in the "base" version of this repository. The base repository
* is immutable and to be left untouched, while methods in this class
* are used as extension methods for more specific persistence-layer
* accessors or mutators.
*
* Base Methods (Subject to be expanded upon in time)
*
* Note: Not all tables are designed appropriately to fit functionality with all base methods
*
* InsertOne
* UpdateOne
* DeleteOne
* FindOne
* GetWhere(std::string where_filter)
* DeleteWhere(std::string where_filter)
* InsertMany
* All
*
* Example custom methods in a repository
*
* AccountFlagsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AccountFlagsRepository::GetWhereNeverExpires()
* AccountFlagsRepository::GetWhereXAndY()
* AccountFlagsRepository::DeleteWhereXAndY()
*
* Most of the above could be covered by base methods, but if you as a developer
* find yourself re-using logic for other parts of the code, its best to just make a
* method that can be re-used easily elsewhere especially if it can use a base repository
* method and encapsulate filters there
*/
// Custom extended repository methods here
};
#endif //EQEMU_ACCOUNT_FLAGS_REPOSITORY_H
@@ -0,0 +1,70 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_ACCOUNT_IP_REPOSITORY_H
#define EQEMU_ACCOUNT_IP_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_account_ip_repository.h"
class AccountIpRepository: public BaseAccountIpRepository {
public:
/**
* This file was auto generated and can be modified and extended upon
*
* Base repository methods are automatically
* generated in the "base" version of this repository. The base repository
* is immutable and to be left untouched, while methods in this class
* are used as extension methods for more specific persistence-layer
* accessors or mutators.
*
* Base Methods (Subject to be expanded upon in time)
*
* Note: Not all tables are designed appropriately to fit functionality with all base methods
*
* InsertOne
* UpdateOne
* DeleteOne
* FindOne
* GetWhere(std::string where_filter)
* DeleteWhere(std::string where_filter)
* InsertMany
* All
*
* Example custom methods in a repository
*
* AccountIpRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AccountIpRepository::GetWhereNeverExpires()
* AccountIpRepository::GetWhereXAndY()
* AccountIpRepository::DeleteWhereXAndY()
*
* Most of the above could be covered by base methods, but if you as a developer
* find yourself re-using logic for other parts of the code, its best to just make a
* method that can be re-used easily elsewhere especially if it can use a base repository
* method and encapsulate filters there
*/
// Custom extended repository methods here
};
#endif //EQEMU_ACCOUNT_IP_REPOSITORY_H
+70
View File
@@ -0,0 +1,70 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_ACCOUNT_REPOSITORY_H
#define EQEMU_ACCOUNT_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_account_repository.h"
class AccountRepository: public BaseAccountRepository {
public:
/**
* This file was auto generated and can be modified and extended upon
*
* Base repository methods are automatically
* generated in the "base" version of this repository. The base repository
* is immutable and to be left untouched, while methods in this class
* are used as extension methods for more specific persistence-layer
* accessors or mutators.
*
* Base Methods (Subject to be expanded upon in time)
*
* Note: Not all tables are designed appropriately to fit functionality with all base methods
*
* InsertOne
* UpdateOne
* DeleteOne
* FindOne
* GetWhere(std::string where_filter)
* DeleteWhere(std::string where_filter)
* InsertMany
* All
*
* Example custom methods in a repository
*
* AccountRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AccountRepository::GetWhereNeverExpires()
* AccountRepository::GetWhereXAndY()
* AccountRepository::DeleteWhereXAndY()
*
* Most of the above could be covered by base methods, but if you as a developer
* find yourself re-using logic for other parts of the code, its best to just make a
* method that can be re-used easily elsewhere especially if it can use a base repository
* method and encapsulate filters there
*/
// Custom extended repository methods here
};
#endif //EQEMU_ACCOUNT_REPOSITORY_H
@@ -0,0 +1,70 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_ACCOUNT_REWARDS_REPOSITORY_H
#define EQEMU_ACCOUNT_REWARDS_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_account_rewards_repository.h"
class AccountRewardsRepository: public BaseAccountRewardsRepository {
public:
/**
* This file was auto generated and can be modified and extended upon
*
* Base repository methods are automatically
* generated in the "base" version of this repository. The base repository
* is immutable and to be left untouched, while methods in this class
* are used as extension methods for more specific persistence-layer
* accessors or mutators.
*
* Base Methods (Subject to be expanded upon in time)
*
* Note: Not all tables are designed appropriately to fit functionality with all base methods
*
* InsertOne
* UpdateOne
* DeleteOne
* FindOne
* GetWhere(std::string where_filter)
* DeleteWhere(std::string where_filter)
* InsertMany
* All
*
* Example custom methods in a repository
*
* AccountRewardsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AccountRewardsRepository::GetWhereNeverExpires()
* AccountRewardsRepository::GetWhereXAndY()
* AccountRewardsRepository::DeleteWhereXAndY()
*
* Most of the above could be covered by base methods, but if you as a developer
* find yourself re-using logic for other parts of the code, its best to just make a
* method that can be re-used easily elsewhere especially if it can use a base repository
* method and encapsulate filters there
*/
// Custom extended repository methods here
};
#endif //EQEMU_ACCOUNT_REWARDS_REPOSITORY_H
@@ -0,0 +1,70 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_ADVENTURE_DETAILS_REPOSITORY_H
#define EQEMU_ADVENTURE_DETAILS_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_adventure_details_repository.h"
class AdventureDetailsRepository: public BaseAdventureDetailsRepository {
public:
/**
* This file was auto generated and can be modified and extended upon
*
* Base repository methods are automatically
* generated in the "base" version of this repository. The base repository
* is immutable and to be left untouched, while methods in this class
* are used as extension methods for more specific persistence-layer
* accessors or mutators.
*
* Base Methods (Subject to be expanded upon in time)
*
* Note: Not all tables are designed appropriately to fit functionality with all base methods
*
* InsertOne
* UpdateOne
* DeleteOne
* FindOne
* GetWhere(std::string where_filter)
* DeleteWhere(std::string where_filter)
* InsertMany
* All
*
* Example custom methods in a repository
*
* AdventureDetailsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AdventureDetailsRepository::GetWhereNeverExpires()
* AdventureDetailsRepository::GetWhereXAndY()
* AdventureDetailsRepository::DeleteWhereXAndY()
*
* Most of the above could be covered by base methods, but if you as a developer
* find yourself re-using logic for other parts of the code, its best to just make a
* method that can be re-used easily elsewhere especially if it can use a base repository
* method and encapsulate filters there
*/
// Custom extended repository methods here
};
#endif //EQEMU_ADVENTURE_DETAILS_REPOSITORY_H
@@ -0,0 +1,70 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_ADVENTURE_MEMBERS_REPOSITORY_H
#define EQEMU_ADVENTURE_MEMBERS_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_adventure_members_repository.h"
class AdventureMembersRepository: public BaseAdventureMembersRepository {
public:
/**
* This file was auto generated and can be modified and extended upon
*
* Base repository methods are automatically
* generated in the "base" version of this repository. The base repository
* is immutable and to be left untouched, while methods in this class
* are used as extension methods for more specific persistence-layer
* accessors or mutators.
*
* Base Methods (Subject to be expanded upon in time)
*
* Note: Not all tables are designed appropriately to fit functionality with all base methods
*
* InsertOne
* UpdateOne
* DeleteOne
* FindOne
* GetWhere(std::string where_filter)
* DeleteWhere(std::string where_filter)
* InsertMany
* All
*
* Example custom methods in a repository
*
* AdventureMembersRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AdventureMembersRepository::GetWhereNeverExpires()
* AdventureMembersRepository::GetWhereXAndY()
* AdventureMembersRepository::DeleteWhereXAndY()
*
* Most of the above could be covered by base methods, but if you as a developer
* find yourself re-using logic for other parts of the code, its best to just make a
* method that can be re-used easily elsewhere especially if it can use a base repository
* method and encapsulate filters there
*/
// Custom extended repository methods here
};
#endif //EQEMU_ADVENTURE_MEMBERS_REPOSITORY_H
@@ -0,0 +1,70 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_ADVENTURE_STATS_REPOSITORY_H
#define EQEMU_ADVENTURE_STATS_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_adventure_stats_repository.h"
class AdventureStatsRepository: public BaseAdventureStatsRepository {
public:
/**
* This file was auto generated and can be modified and extended upon
*
* Base repository methods are automatically
* generated in the "base" version of this repository. The base repository
* is immutable and to be left untouched, while methods in this class
* are used as extension methods for more specific persistence-layer
* accessors or mutators.
*
* Base Methods (Subject to be expanded upon in time)
*
* Note: Not all tables are designed appropriately to fit functionality with all base methods
*
* InsertOne
* UpdateOne
* DeleteOne
* FindOne
* GetWhere(std::string where_filter)
* DeleteWhere(std::string where_filter)
* InsertMany
* All
*
* Example custom methods in a repository
*
* AdventureStatsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AdventureStatsRepository::GetWhereNeverExpires()
* AdventureStatsRepository::GetWhereXAndY()
* AdventureStatsRepository::DeleteWhereXAndY()
*
* Most of the above could be covered by base methods, but if you as a developer
* find yourself re-using logic for other parts of the code, its best to just make a
* method that can be re-used easily elsewhere especially if it can use a base repository
* method and encapsulate filters there
*/
// Custom extended repository methods here
};
#endif //EQEMU_ADVENTURE_STATS_REPOSITORY_H
@@ -0,0 +1,70 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_ADVENTURE_TEMPLATE_ENTRY_FLAVOR_REPOSITORY_H
#define EQEMU_ADVENTURE_TEMPLATE_ENTRY_FLAVOR_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_adventure_template_entry_flavor_repository.h"
class AdventureTemplateEntryFlavorRepository: public BaseAdventureTemplateEntryFlavorRepository {
public:
/**
* This file was auto generated and can be modified and extended upon
*
* Base repository methods are automatically
* generated in the "base" version of this repository. The base repository
* is immutable and to be left untouched, while methods in this class
* are used as extension methods for more specific persistence-layer
* accessors or mutators.
*
* Base Methods (Subject to be expanded upon in time)
*
* Note: Not all tables are designed appropriately to fit functionality with all base methods
*
* InsertOne
* UpdateOne
* DeleteOne
* FindOne
* GetWhere(std::string where_filter)
* DeleteWhere(std::string where_filter)
* InsertMany
* All
*
* Example custom methods in a repository
*
* AdventureTemplateEntryFlavorRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AdventureTemplateEntryFlavorRepository::GetWhereNeverExpires()
* AdventureTemplateEntryFlavorRepository::GetWhereXAndY()
* AdventureTemplateEntryFlavorRepository::DeleteWhereXAndY()
*
* Most of the above could be covered by base methods, but if you as a developer
* find yourself re-using logic for other parts of the code, its best to just make a
* method that can be re-used easily elsewhere especially if it can use a base repository
* method and encapsulate filters there
*/
// Custom extended repository methods here
};
#endif //EQEMU_ADVENTURE_TEMPLATE_ENTRY_FLAVOR_REPOSITORY_H
@@ -0,0 +1,70 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_ADVENTURE_TEMPLATE_ENTRY_REPOSITORY_H
#define EQEMU_ADVENTURE_TEMPLATE_ENTRY_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_adventure_template_entry_repository.h"
class AdventureTemplateEntryRepository: public BaseAdventureTemplateEntryRepository {
public:
/**
* This file was auto generated and can be modified and extended upon
*
* Base repository methods are automatically
* generated in the "base" version of this repository. The base repository
* is immutable and to be left untouched, while methods in this class
* are used as extension methods for more specific persistence-layer
* accessors or mutators.
*
* Base Methods (Subject to be expanded upon in time)
*
* Note: Not all tables are designed appropriately to fit functionality with all base methods
*
* InsertOne
* UpdateOne
* DeleteOne
* FindOne
* GetWhere(std::string where_filter)
* DeleteWhere(std::string where_filter)
* InsertMany
* All
*
* Example custom methods in a repository
*
* AdventureTemplateEntryRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AdventureTemplateEntryRepository::GetWhereNeverExpires()
* AdventureTemplateEntryRepository::GetWhereXAndY()
* AdventureTemplateEntryRepository::DeleteWhereXAndY()
*
* Most of the above could be covered by base methods, but if you as a developer
* find yourself re-using logic for other parts of the code, its best to just make a
* method that can be re-used easily elsewhere especially if it can use a base repository
* method and encapsulate filters there
*/
// Custom extended repository methods here
};
#endif //EQEMU_ADVENTURE_TEMPLATE_ENTRY_REPOSITORY_H
@@ -0,0 +1,70 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_ADVENTURE_TEMPLATE_REPOSITORY_H
#define EQEMU_ADVENTURE_TEMPLATE_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_adventure_template_repository.h"
class AdventureTemplateRepository: public BaseAdventureTemplateRepository {
public:
/**
* This file was auto generated and can be modified and extended upon
*
* Base repository methods are automatically
* generated in the "base" version of this repository. The base repository
* is immutable and to be left untouched, while methods in this class
* are used as extension methods for more specific persistence-layer
* accessors or mutators.
*
* Base Methods (Subject to be expanded upon in time)
*
* Note: Not all tables are designed appropriately to fit functionality with all base methods
*
* InsertOne
* UpdateOne
* DeleteOne
* FindOne
* GetWhere(std::string where_filter)
* DeleteWhere(std::string where_filter)
* InsertMany
* All
*
* Example custom methods in a repository
*
* AdventureTemplateRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AdventureTemplateRepository::GetWhereNeverExpires()
* AdventureTemplateRepository::GetWhereXAndY()
* AdventureTemplateRepository::DeleteWhereXAndY()
*
* Most of the above could be covered by base methods, but if you as a developer
* find yourself re-using logic for other parts of the code, its best to just make a
* method that can be re-used easily elsewhere especially if it can use a base repository
* method and encapsulate filters there
*/
// Custom extended repository methods here
};
#endif //EQEMU_ADVENTURE_TEMPLATE_REPOSITORY_H
@@ -0,0 +1,70 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_ALTERNATE_CURRENCY_REPOSITORY_H
#define EQEMU_ALTERNATE_CURRENCY_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_alternate_currency_repository.h"
class AlternateCurrencyRepository: public BaseAlternateCurrencyRepository {
public:
/**
* This file was auto generated and can be modified and extended upon
*
* Base repository methods are automatically
* generated in the "base" version of this repository. The base repository
* is immutable and to be left untouched, while methods in this class
* are used as extension methods for more specific persistence-layer
* accessors or mutators.
*
* Base Methods (Subject to be expanded upon in time)
*
* Note: Not all tables are designed appropriately to fit functionality with all base methods
*
* InsertOne
* UpdateOne
* DeleteOne
* FindOne
* GetWhere(std::string where_filter)
* DeleteWhere(std::string where_filter)
* InsertMany
* All
*
* Example custom methods in a repository
*
* AlternateCurrencyRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AlternateCurrencyRepository::GetWhereNeverExpires()
* AlternateCurrencyRepository::GetWhereXAndY()
* AlternateCurrencyRepository::DeleteWhereXAndY()
*
* Most of the above could be covered by base methods, but if you as a developer
* find yourself re-using logic for other parts of the code, its best to just make a
* method that can be re-used easily elsewhere especially if it can use a base repository
* method and encapsulate filters there
*/
// Custom extended repository methods here
};
#endif //EQEMU_ALTERNATE_CURRENCY_REPOSITORY_H
+70
View File
@@ -0,0 +1,70 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_AURAS_REPOSITORY_H
#define EQEMU_AURAS_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_auras_repository.h"
class AurasRepository: public BaseAurasRepository {
public:
/**
* This file was auto generated and can be modified and extended upon
*
* Base repository methods are automatically
* generated in the "base" version of this repository. The base repository
* is immutable and to be left untouched, while methods in this class
* are used as extension methods for more specific persistence-layer
* accessors or mutators.
*
* Base Methods (Subject to be expanded upon in time)
*
* Note: Not all tables are designed appropriately to fit functionality with all base methods
*
* InsertOne
* UpdateOne
* DeleteOne
* FindOne
* GetWhere(std::string where_filter)
* DeleteWhere(std::string where_filter)
* InsertMany
* All
*
* Example custom methods in a repository
*
* AurasRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AurasRepository::GetWhereNeverExpires()
* AurasRepository::GetWhereXAndY()
* AurasRepository::DeleteWhereXAndY()
*
* Most of the above could be covered by base methods, but if you as a developer
* find yourself re-using logic for other parts of the code, its best to just make a
* method that can be re-used easily elsewhere especially if it can use a base repository
* method and encapsulate filters there
*/
// Custom extended repository methods here
};
#endif //EQEMU_AURAS_REPOSITORY_H
@@ -0,0 +1,428 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_AA_ABILITY_REPOSITORY_H
#define EQEMU_BASE_AA_ABILITY_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAaAbilityRepository {
public:
struct AaAbility {
int id;
std::string name;
int category;
int classes;
int races;
int drakkin_heritage;
int deities;
int status;
int type;
int charges;
int grant_only;
int first_rank_id;
int enabled;
int reset_on_death;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"name",
"category",
"classes",
"races",
"drakkin_heritage",
"deities",
"status",
"type",
"charges",
"grant_only",
"first_rank_id",
"enabled",
"reset_on_death",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string 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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static AaAbility NewEntity()
{
AaAbility entry{};
entry.id = 0;
entry.name = "";
entry.category = -1;
entry.classes = 131070;
entry.races = 65535;
entry.drakkin_heritage = 127;
entry.deities = 131071;
entry.status = 0;
entry.type = 0;
entry.charges = 0;
entry.grant_only = 0;
entry.first_rank_id = -1;
entry.enabled = 1;
entry.reset_on_death = 0;
return entry;
}
static AaAbility GetAaAbilityEntry(
const std::vector<AaAbility> &aa_abilitys,
int aa_ability_id
)
{
for (auto &aa_ability : aa_abilitys) {
if (aa_ability.id == aa_ability_id) {
return aa_ability;
}
}
return NewEntity();
}
static AaAbility FindOne(
int aa_ability_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
aa_ability_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AaAbility entry{};
entry.id = atoi(row[0]);
entry.name = row[1] ? row[1] : "";
entry.category = atoi(row[2]);
entry.classes = atoi(row[3]);
entry.races = atoi(row[4]);
entry.drakkin_heritage = atoi(row[5]);
entry.deities = atoi(row[6]);
entry.status = atoi(row[7]);
entry.type = atoi(row[8]);
entry.charges = atoi(row[9]);
entry.grant_only = atoi(row[10]);
entry.first_rank_id = atoi(row[11]);
entry.enabled = atoi(row[12]);
entry.reset_on_death = atoi(row[13]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int aa_ability_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
aa_ability_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
AaAbility aa_ability_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(aa_ability_entry.id));
update_values.push_back(columns[1] + " = '" + EscapeString(aa_ability_entry.name) + "'");
update_values.push_back(columns[2] + " = " + std::to_string(aa_ability_entry.category));
update_values.push_back(columns[3] + " = " + std::to_string(aa_ability_entry.classes));
update_values.push_back(columns[4] + " = " + std::to_string(aa_ability_entry.races));
update_values.push_back(columns[5] + " = " + std::to_string(aa_ability_entry.drakkin_heritage));
update_values.push_back(columns[6] + " = " + std::to_string(aa_ability_entry.deities));
update_values.push_back(columns[7] + " = " + std::to_string(aa_ability_entry.status));
update_values.push_back(columns[8] + " = " + std::to_string(aa_ability_entry.type));
update_values.push_back(columns[9] + " = " + std::to_string(aa_ability_entry.charges));
update_values.push_back(columns[10] + " = " + std::to_string(aa_ability_entry.grant_only));
update_values.push_back(columns[11] + " = " + std::to_string(aa_ability_entry.first_rank_id));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
aa_ability_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AaAbility InsertOne(
AaAbility aa_ability_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(aa_ability_entry.id));
insert_values.push_back("'" + EscapeString(aa_ability_entry.name) + "'");
insert_values.push_back(std::to_string(aa_ability_entry.category));
insert_values.push_back(std::to_string(aa_ability_entry.classes));
insert_values.push_back(std::to_string(aa_ability_entry.races));
insert_values.push_back(std::to_string(aa_ability_entry.drakkin_heritage));
insert_values.push_back(std::to_string(aa_ability_entry.deities));
insert_values.push_back(std::to_string(aa_ability_entry.status));
insert_values.push_back(std::to_string(aa_ability_entry.type));
insert_values.push_back(std::to_string(aa_ability_entry.charges));
insert_values.push_back(std::to_string(aa_ability_entry.grant_only));
insert_values.push_back(std::to_string(aa_ability_entry.first_rank_id));
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
aa_ability_entry.id = results.LastInsertedID();
return aa_ability_entry;
}
aa_ability_entry = NewEntity();
return aa_ability_entry;
}
static int InsertMany(
std::vector<AaAbility> aa_ability_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &aa_ability_entry: aa_ability_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(aa_ability_entry.id));
insert_values.push_back("'" + EscapeString(aa_ability_entry.name) + "'");
insert_values.push_back(std::to_string(aa_ability_entry.category));
insert_values.push_back(std::to_string(aa_ability_entry.classes));
insert_values.push_back(std::to_string(aa_ability_entry.races));
insert_values.push_back(std::to_string(aa_ability_entry.drakkin_heritage));
insert_values.push_back(std::to_string(aa_ability_entry.deities));
insert_values.push_back(std::to_string(aa_ability_entry.status));
insert_values.push_back(std::to_string(aa_ability_entry.type));
insert_values.push_back(std::to_string(aa_ability_entry.charges));
insert_values.push_back(std::to_string(aa_ability_entry.grant_only));
insert_values.push_back(std::to_string(aa_ability_entry.first_rank_id));
insert_values.push_back(std::to_string(aa_ability_entry.enabled));
insert_values.push_back(std::to_string(aa_ability_entry.reset_on_death));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AaAbility> All()
{
std::vector<AaAbility> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AaAbility entry{};
entry.id = atoi(row[0]);
entry.name = row[1] ? row[1] : "";
entry.category = atoi(row[2]);
entry.classes = atoi(row[3]);
entry.races = atoi(row[4]);
entry.drakkin_heritage = atoi(row[5]);
entry.deities = atoi(row[6]);
entry.status = atoi(row[7]);
entry.type = atoi(row[8]);
entry.charges = atoi(row[9]);
entry.grant_only = atoi(row[10]);
entry.first_rank_id = atoi(row[11]);
entry.enabled = atoi(row[12]);
entry.reset_on_death = atoi(row[13]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AaAbility> GetWhere(std::string where_filter)
{
std::vector<AaAbility> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AaAbility entry{};
entry.id = atoi(row[0]);
entry.name = row[1] ? row[1] : "";
entry.category = atoi(row[2]);
entry.classes = atoi(row[3]);
entry.races = atoi(row[4]);
entry.drakkin_heritage = atoi(row[5]);
entry.deities = atoi(row[6]);
entry.status = atoi(row[7]);
entry.type = atoi(row[8]);
entry.charges = atoi(row[9]);
entry.grant_only = atoi(row[10]);
entry.first_rank_id = atoi(row[11]);
entry.enabled = atoi(row[12]);
entry.reset_on_death = atoi(row[13]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = content_db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_AA_ABILITY_REPOSITORY_H
@@ -0,0 +1,347 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_AA_RANK_EFFECTS_REPOSITORY_H
#define EQEMU_BASE_AA_RANK_EFFECTS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAaRankEffectsRepository {
public:
struct AaRankEffects {
int rank_id;
int slot;
int effect_id;
int base1;
int base2;
};
static std::string PrimaryKey()
{
return std::string("rank_id");
}
static std::vector<std::string> Columns()
{
return {
"rank_id",
"slot",
"effect_id",
"base1",
"base2",
};
}
static std::string ColumnsRaw()
{
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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static AaRankEffects NewEntity()
{
AaRankEffects entry{};
entry.rank_id = 0;
entry.slot = 1;
entry.effect_id = 0;
entry.base1 = 0;
entry.base2 = 0;
return entry;
}
static AaRankEffects GetAaRankEffectsEntry(
const std::vector<AaRankEffects> &aa_rank_effectss,
int aa_rank_effects_id
)
{
for (auto &aa_rank_effects : aa_rank_effectss) {
if (aa_rank_effects.rank_id == aa_rank_effects_id) {
return aa_rank_effects;
}
}
return NewEntity();
}
static AaRankEffects FindOne(
int aa_rank_effects_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
aa_rank_effects_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AaRankEffects entry{};
entry.rank_id = atoi(row[0]);
entry.slot = atoi(row[1]);
entry.effect_id = atoi(row[2]);
entry.base1 = atoi(row[3]);
entry.base2 = atoi(row[4]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int aa_rank_effects_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
aa_rank_effects_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
AaRankEffects aa_rank_effects_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(aa_rank_effects_entry.rank_id));
update_values.push_back(columns[1] + " = " + std::to_string(aa_rank_effects_entry.slot));
update_values.push_back(columns[2] + " = " + std::to_string(aa_rank_effects_entry.effect_id));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
aa_rank_effects_entry.rank_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AaRankEffects InsertOne(
AaRankEffects aa_rank_effects_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(aa_rank_effects_entry.rank_id));
insert_values.push_back(std::to_string(aa_rank_effects_entry.slot));
insert_values.push_back(std::to_string(aa_rank_effects_entry.effect_id));
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
aa_rank_effects_entry.rank_id = results.LastInsertedID();
return aa_rank_effects_entry;
}
aa_rank_effects_entry = NewEntity();
return aa_rank_effects_entry;
}
static int InsertMany(
std::vector<AaRankEffects> aa_rank_effects_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &aa_rank_effects_entry: aa_rank_effects_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(aa_rank_effects_entry.rank_id));
insert_values.push_back(std::to_string(aa_rank_effects_entry.slot));
insert_values.push_back(std::to_string(aa_rank_effects_entry.effect_id));
insert_values.push_back(std::to_string(aa_rank_effects_entry.base1));
insert_values.push_back(std::to_string(aa_rank_effects_entry.base2));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AaRankEffects> All()
{
std::vector<AaRankEffects> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AaRankEffects entry{};
entry.rank_id = atoi(row[0]);
entry.slot = atoi(row[1]);
entry.effect_id = atoi(row[2]);
entry.base1 = atoi(row[3]);
entry.base2 = atoi(row[4]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AaRankEffects> GetWhere(std::string where_filter)
{
std::vector<AaRankEffects> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AaRankEffects entry{};
entry.rank_id = atoi(row[0]);
entry.slot = atoi(row[1]);
entry.effect_id = atoi(row[2]);
entry.base1 = atoi(row[3]);
entry.base2 = atoi(row[4]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = content_db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_AA_RANK_EFFECTS_REPOSITORY_H
@@ -0,0 +1,329 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_AA_RANK_PREREQS_REPOSITORY_H
#define EQEMU_BASE_AA_RANK_PREREQS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAaRankPrereqsRepository {
public:
struct AaRankPrereqs {
int rank_id;
int aa_id;
int points;
};
static std::string PrimaryKey()
{
return std::string("rank_id");
}
static std::vector<std::string> Columns()
{
return {
"rank_id",
"aa_id",
"points",
};
}
static std::string ColumnsRaw()
{
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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static AaRankPrereqs NewEntity()
{
AaRankPrereqs entry{};
entry.rank_id = 0;
entry.aa_id = 0;
entry.points = 0;
return entry;
}
static AaRankPrereqs GetAaRankPrereqsEntry(
const std::vector<AaRankPrereqs> &aa_rank_prereqss,
int aa_rank_prereqs_id
)
{
for (auto &aa_rank_prereqs : aa_rank_prereqss) {
if (aa_rank_prereqs.rank_id == aa_rank_prereqs_id) {
return aa_rank_prereqs;
}
}
return NewEntity();
}
static AaRankPrereqs FindOne(
int aa_rank_prereqs_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
aa_rank_prereqs_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AaRankPrereqs entry{};
entry.rank_id = atoi(row[0]);
entry.aa_id = atoi(row[1]);
entry.points = atoi(row[2]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int aa_rank_prereqs_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
aa_rank_prereqs_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
AaRankPrereqs aa_rank_prereqs_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(aa_rank_prereqs_entry.rank_id));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
aa_rank_prereqs_entry.rank_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AaRankPrereqs InsertOne(
AaRankPrereqs aa_rank_prereqs_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(aa_rank_prereqs_entry.rank_id));
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
aa_rank_prereqs_entry.rank_id = results.LastInsertedID();
return aa_rank_prereqs_entry;
}
aa_rank_prereqs_entry = NewEntity();
return aa_rank_prereqs_entry;
}
static int InsertMany(
std::vector<AaRankPrereqs> aa_rank_prereqs_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &aa_rank_prereqs_entry: aa_rank_prereqs_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(aa_rank_prereqs_entry.rank_id));
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));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AaRankPrereqs> All()
{
std::vector<AaRankPrereqs> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AaRankPrereqs entry{};
entry.rank_id = atoi(row[0]);
entry.aa_id = atoi(row[1]);
entry.points = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AaRankPrereqs> GetWhere(std::string where_filter)
{
std::vector<AaRankPrereqs> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AaRankPrereqs entry{};
entry.rank_id = atoi(row[0]);
entry.aa_id = atoi(row[1]);
entry.points = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = content_db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_AA_RANK_PREREQS_REPOSITORY_H
@@ -0,0 +1,419 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_AA_RANKS_REPOSITORY_H
#define EQEMU_BASE_AA_RANKS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAaRanksRepository {
public:
struct AaRanks {
int id;
int upper_hotkey_sid;
int lower_hotkey_sid;
int title_sid;
int desc_sid;
int cost;
int level_req;
int spell;
int spell_type;
int recast_time;
int expansion;
int prev_id;
int next_id;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"upper_hotkey_sid",
"lower_hotkey_sid",
"title_sid",
"desc_sid",
"cost",
"level_req",
"spell",
"spell_type",
"recast_time",
"expansion",
"prev_id",
"next_id",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string 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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static AaRanks NewEntity()
{
AaRanks entry{};
entry.id = 0;
entry.upper_hotkey_sid = -1;
entry.lower_hotkey_sid = -1;
entry.title_sid = -1;
entry.desc_sid = -1;
entry.cost = 1;
entry.level_req = 51;
entry.spell = -1;
entry.spell_type = 0;
entry.recast_time = 0;
entry.expansion = 0;
entry.prev_id = -1;
entry.next_id = -1;
return entry;
}
static AaRanks GetAaRanksEntry(
const std::vector<AaRanks> &aa_rankss,
int aa_ranks_id
)
{
for (auto &aa_ranks : aa_rankss) {
if (aa_ranks.id == aa_ranks_id) {
return aa_ranks;
}
}
return NewEntity();
}
static AaRanks FindOne(
int aa_ranks_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
aa_ranks_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AaRanks entry{};
entry.id = atoi(row[0]);
entry.upper_hotkey_sid = atoi(row[1]);
entry.lower_hotkey_sid = atoi(row[2]);
entry.title_sid = atoi(row[3]);
entry.desc_sid = atoi(row[4]);
entry.cost = atoi(row[5]);
entry.level_req = atoi(row[6]);
entry.spell = atoi(row[7]);
entry.spell_type = atoi(row[8]);
entry.recast_time = atoi(row[9]);
entry.expansion = atoi(row[10]);
entry.prev_id = atoi(row[11]);
entry.next_id = atoi(row[12]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int aa_ranks_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
aa_ranks_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
AaRanks aa_ranks_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(aa_ranks_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(aa_ranks_entry.upper_hotkey_sid));
update_values.push_back(columns[2] + " = " + std::to_string(aa_ranks_entry.lower_hotkey_sid));
update_values.push_back(columns[3] + " = " + std::to_string(aa_ranks_entry.title_sid));
update_values.push_back(columns[4] + " = " + std::to_string(aa_ranks_entry.desc_sid));
update_values.push_back(columns[5] + " = " + std::to_string(aa_ranks_entry.cost));
update_values.push_back(columns[6] + " = " + std::to_string(aa_ranks_entry.level_req));
update_values.push_back(columns[7] + " = " + std::to_string(aa_ranks_entry.spell));
update_values.push_back(columns[8] + " = " + std::to_string(aa_ranks_entry.spell_type));
update_values.push_back(columns[9] + " = " + std::to_string(aa_ranks_entry.recast_time));
update_values.push_back(columns[10] + " = " + std::to_string(aa_ranks_entry.expansion));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
aa_ranks_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AaRanks InsertOne(
AaRanks aa_ranks_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(aa_ranks_entry.id));
insert_values.push_back(std::to_string(aa_ranks_entry.upper_hotkey_sid));
insert_values.push_back(std::to_string(aa_ranks_entry.lower_hotkey_sid));
insert_values.push_back(std::to_string(aa_ranks_entry.title_sid));
insert_values.push_back(std::to_string(aa_ranks_entry.desc_sid));
insert_values.push_back(std::to_string(aa_ranks_entry.cost));
insert_values.push_back(std::to_string(aa_ranks_entry.level_req));
insert_values.push_back(std::to_string(aa_ranks_entry.spell));
insert_values.push_back(std::to_string(aa_ranks_entry.spell_type));
insert_values.push_back(std::to_string(aa_ranks_entry.recast_time));
insert_values.push_back(std::to_string(aa_ranks_entry.expansion));
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
aa_ranks_entry.id = results.LastInsertedID();
return aa_ranks_entry;
}
aa_ranks_entry = NewEntity();
return aa_ranks_entry;
}
static int InsertMany(
std::vector<AaRanks> aa_ranks_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &aa_ranks_entry: aa_ranks_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(aa_ranks_entry.id));
insert_values.push_back(std::to_string(aa_ranks_entry.upper_hotkey_sid));
insert_values.push_back(std::to_string(aa_ranks_entry.lower_hotkey_sid));
insert_values.push_back(std::to_string(aa_ranks_entry.title_sid));
insert_values.push_back(std::to_string(aa_ranks_entry.desc_sid));
insert_values.push_back(std::to_string(aa_ranks_entry.cost));
insert_values.push_back(std::to_string(aa_ranks_entry.level_req));
insert_values.push_back(std::to_string(aa_ranks_entry.spell));
insert_values.push_back(std::to_string(aa_ranks_entry.spell_type));
insert_values.push_back(std::to_string(aa_ranks_entry.recast_time));
insert_values.push_back(std::to_string(aa_ranks_entry.expansion));
insert_values.push_back(std::to_string(aa_ranks_entry.prev_id));
insert_values.push_back(std::to_string(aa_ranks_entry.next_id));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AaRanks> All()
{
std::vector<AaRanks> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AaRanks entry{};
entry.id = atoi(row[0]);
entry.upper_hotkey_sid = atoi(row[1]);
entry.lower_hotkey_sid = atoi(row[2]);
entry.title_sid = atoi(row[3]);
entry.desc_sid = atoi(row[4]);
entry.cost = atoi(row[5]);
entry.level_req = atoi(row[6]);
entry.spell = atoi(row[7]);
entry.spell_type = atoi(row[8]);
entry.recast_time = atoi(row[9]);
entry.expansion = atoi(row[10]);
entry.prev_id = atoi(row[11]);
entry.next_id = atoi(row[12]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AaRanks> GetWhere(std::string where_filter)
{
std::vector<AaRanks> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AaRanks entry{};
entry.id = atoi(row[0]);
entry.upper_hotkey_sid = atoi(row[1]);
entry.lower_hotkey_sid = atoi(row[2]);
entry.title_sid = atoi(row[3]);
entry.desc_sid = atoi(row[4]);
entry.cost = atoi(row[5]);
entry.level_req = atoi(row[6]);
entry.spell = atoi(row[7]);
entry.spell_type = atoi(row[8]);
entry.recast_time = atoi(row[9]);
entry.expansion = atoi(row[10]);
entry.prev_id = atoi(row[11]);
entry.next_id = atoi(row[12]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = content_db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_AA_RANKS_REPOSITORY_H
@@ -0,0 +1,329 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_ACCOUNT_FLAGS_REPOSITORY_H
#define EQEMU_BASE_ACCOUNT_FLAGS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAccountFlagsRepository {
public:
struct AccountFlags {
int p_accid;
std::string p_flag;
std::string p_value;
};
static std::string PrimaryKey()
{
return std::string("p_accid");
}
static std::vector<std::string> Columns()
{
return {
"p_accid",
"p_flag",
"p_value",
};
}
static std::string ColumnsRaw()
{
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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static AccountFlags NewEntity()
{
AccountFlags entry{};
entry.p_accid = 0;
entry.p_flag = "";
entry.p_value = "";
return entry;
}
static AccountFlags GetAccountFlagsEntry(
const std::vector<AccountFlags> &account_flagss,
int account_flags_id
)
{
for (auto &account_flags : account_flagss) {
if (account_flags.p_accid == account_flags_id) {
return account_flags;
}
}
return NewEntity();
}
static AccountFlags FindOne(
int account_flags_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
account_flags_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AccountFlags entry{};
entry.p_accid = atoi(row[0]);
entry.p_flag = row[1] ? row[1] : "";
entry.p_value = row[2] ? row[2] : "";
return entry;
}
return NewEntity();
}
static int DeleteOne(
int account_flags_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
account_flags_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
AccountFlags account_flags_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(account_flags_entry.p_accid));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
account_flags_entry.p_accid
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AccountFlags InsertOne(
AccountFlags account_flags_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(account_flags_entry.p_accid));
insert_values.push_back("'" + EscapeString(account_flags_entry.p_flag) + "'");
insert_values.push_back("'" + EscapeString(account_flags_entry.p_value) + "'");
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
account_flags_entry.p_accid = results.LastInsertedID();
return account_flags_entry;
}
account_flags_entry = NewEntity();
return account_flags_entry;
}
static int InsertMany(
std::vector<AccountFlags> account_flags_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &account_flags_entry: account_flags_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(account_flags_entry.p_accid));
insert_values.push_back("'" + EscapeString(account_flags_entry.p_flag) + "'");
insert_values.push_back("'" + EscapeString(account_flags_entry.p_value) + "'");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AccountFlags> All()
{
std::vector<AccountFlags> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AccountFlags entry{};
entry.p_accid = atoi(row[0]);
entry.p_flag = row[1] ? row[1] : "";
entry.p_value = row[2] ? row[2] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AccountFlags> GetWhere(std::string where_filter)
{
std::vector<AccountFlags> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AccountFlags entry{};
entry.p_accid = atoi(row[0]);
entry.p_flag = row[1] ? row[1] : "";
entry.p_value = row[2] ? row[2] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = database.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_ACCOUNT_FLAGS_REPOSITORY_H
@@ -0,0 +1,338 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_ACCOUNT_IP_REPOSITORY_H
#define EQEMU_BASE_ACCOUNT_IP_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAccountIpRepository {
public:
struct AccountIp {
int accid;
std::string ip;
int count;
std::string lastused;
};
static std::string PrimaryKey()
{
return std::string("accid");
}
static std::vector<std::string> Columns()
{
return {
"accid",
"ip",
"count",
"lastused",
};
}
static std::string ColumnsRaw()
{
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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static AccountIp NewEntity()
{
AccountIp entry{};
entry.accid = 0;
entry.ip = "";
entry.count = 1;
entry.lastused = current_timestamp();
return entry;
}
static AccountIp GetAccountIpEntry(
const std::vector<AccountIp> &account_ips,
int account_ip_id
)
{
for (auto &account_ip : account_ips) {
if (account_ip.accid == account_ip_id) {
return account_ip;
}
}
return NewEntity();
}
static AccountIp FindOne(
int account_ip_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
account_ip_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AccountIp entry{};
entry.accid = atoi(row[0]);
entry.ip = row[1] ? row[1] : "";
entry.count = atoi(row[2]);
entry.lastused = row[3] ? row[3] : "";
return entry;
}
return NewEntity();
}
static int DeleteOne(
int account_ip_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
account_ip_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
AccountIp account_ip_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(account_ip_entry.accid));
update_values.push_back(columns[1] + " = '" + EscapeString(account_ip_entry.ip) + "'");
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
account_ip_entry.accid
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AccountIp InsertOne(
AccountIp account_ip_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(account_ip_entry.accid));
insert_values.push_back("'" + EscapeString(account_ip_entry.ip) + "'");
insert_values.push_back(std::to_string(account_ip_entry.count));
insert_values.push_back("'" + EscapeString(account_ip_entry.lastused) + "'");
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
account_ip_entry.accid = results.LastInsertedID();
return account_ip_entry;
}
account_ip_entry = NewEntity();
return account_ip_entry;
}
static int InsertMany(
std::vector<AccountIp> account_ip_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &account_ip_entry: account_ip_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(account_ip_entry.accid));
insert_values.push_back("'" + EscapeString(account_ip_entry.ip) + "'");
insert_values.push_back(std::to_string(account_ip_entry.count));
insert_values.push_back("'" + EscapeString(account_ip_entry.lastused) + "'");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AccountIp> All()
{
std::vector<AccountIp> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AccountIp entry{};
entry.accid = atoi(row[0]);
entry.ip = row[1] ? row[1] : "";
entry.count = atoi(row[2]);
entry.lastused = row[3] ? row[3] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AccountIp> GetWhere(std::string where_filter)
{
std::vector<AccountIp> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AccountIp entry{};
entry.accid = atoi(row[0]);
entry.ip = row[1] ? row[1] : "";
entry.count = atoi(row[2]);
entry.lastused = row[3] ? row[3] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = database.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_ACCOUNT_IP_REPOSITORY_H
@@ -0,0 +1,470 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_ACCOUNT_REPOSITORY_H
#define EQEMU_BASE_ACCOUNT_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAccountRepository {
public:
struct Account {
int id;
std::string name;
std::string charname;
int sharedplat;
std::string password;
int status;
std::string ls_id;
int lsaccount_id;
int gmspeed;
int revoked;
int karma;
std::string minilogin_ip;
int hideme;
int rulesflag;
std::string suspendeduntil;
int time_creation;
int expansion;
std::string ban_reason;
std::string suspend_reason;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"name",
"charname",
"sharedplat",
"password",
"status",
"ls_id",
"lsaccount_id",
"gmspeed",
"revoked",
"karma",
"minilogin_ip",
"hideme",
"rulesflag",
"suspendeduntil",
"time_creation",
"expansion",
"ban_reason",
"suspend_reason",
};
}
static std::string ColumnsRaw()
{
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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static Account NewEntity()
{
Account entry{};
entry.id = 0;
entry.name = "";
entry.charname = "";
entry.sharedplat = 0;
entry.password = "";
entry.status = 0;
entry.ls_id = "eqemu";
entry.lsaccount_id = 0;
entry.gmspeed = 0;
entry.revoked = 0;
entry.karma = 0;
entry.minilogin_ip = "";
entry.hideme = 0;
entry.rulesflag = 0;
entry.suspendeduntil = "0000-00-00 00:00:00";
entry.time_creation = 0;
entry.expansion = 0;
entry.ban_reason = "";
entry.suspend_reason = "";
return entry;
}
static Account GetAccountEntry(
const std::vector<Account> &accounts,
int account_id
)
{
for (auto &account : accounts) {
if (account.id == account_id) {
return account;
}
}
return NewEntity();
}
static Account FindOne(
int account_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
account_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
Account entry{};
entry.id = atoi(row[0]);
entry.name = row[1] ? row[1] : "";
entry.charname = row[2] ? row[2] : "";
entry.sharedplat = atoi(row[3]);
entry.password = row[4] ? row[4] : "";
entry.status = atoi(row[5]);
entry.ls_id = row[6] ? row[6] : "";
entry.lsaccount_id = atoi(row[7]);
entry.gmspeed = atoi(row[8]);
entry.revoked = atoi(row[9]);
entry.karma = atoi(row[10]);
entry.minilogin_ip = row[11] ? row[11] : "";
entry.hideme = atoi(row[12]);
entry.rulesflag = atoi(row[13]);
entry.suspendeduntil = row[14] ? row[14] : "";
entry.time_creation = atoi(row[15]);
entry.expansion = atoi(row[16]);
entry.ban_reason = row[17] ? row[17] : "";
entry.suspend_reason = row[18] ? row[18] : "";
return entry;
}
return NewEntity();
}
static int DeleteOne(
int account_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
account_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Account account_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[1] + " = '" + EscapeString(account_entry.name) + "'");
update_values.push_back(columns[2] + " = '" + EscapeString(account_entry.charname) + "'");
update_values.push_back(columns[3] + " = " + std::to_string(account_entry.sharedplat));
update_values.push_back(columns[4] + " = '" + EscapeString(account_entry.password) + "'");
update_values.push_back(columns[5] + " = " + std::to_string(account_entry.status));
update_values.push_back(columns[6] + " = '" + EscapeString(account_entry.ls_id) + "'");
update_values.push_back(columns[7] + " = " + std::to_string(account_entry.lsaccount_id));
update_values.push_back(columns[8] + " = " + std::to_string(account_entry.gmspeed));
update_values.push_back(columns[9] + " = " + std::to_string(account_entry.revoked));
update_values.push_back(columns[10] + " = " + std::to_string(account_entry.karma));
update_values.push_back(columns[11] + " = '" + EscapeString(account_entry.minilogin_ip) + "'");
update_values.push_back(columns[12] + " = " + std::to_string(account_entry.hideme));
update_values.push_back(columns[13] + " = " + std::to_string(account_entry.rulesflag));
update_values.push_back(columns[14] + " = '" + EscapeString(account_entry.suspendeduntil) + "'");
update_values.push_back(columns[15] + " = " + std::to_string(account_entry.time_creation));
update_values.push_back(columns[16] + " = " + std::to_string(account_entry.expansion));
update_values.push_back(columns[17] + " = '" + EscapeString(account_entry.ban_reason) + "'");
update_values.push_back(columns[18] + " = '" + EscapeString(account_entry.suspend_reason) + "'");
auto results = database.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
account_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static Account InsertOne(
Account account_entry
)
{
std::vector<std::string> insert_values;
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));
insert_values.push_back("'" + EscapeString(account_entry.password) + "'");
insert_values.push_back(std::to_string(account_entry.status));
insert_values.push_back("'" + EscapeString(account_entry.ls_id) + "'");
insert_values.push_back(std::to_string(account_entry.lsaccount_id));
insert_values.push_back(std::to_string(account_entry.gmspeed));
insert_values.push_back(std::to_string(account_entry.revoked));
insert_values.push_back(std::to_string(account_entry.karma));
insert_values.push_back("'" + EscapeString(account_entry.minilogin_ip) + "'");
insert_values.push_back(std::to_string(account_entry.hideme));
insert_values.push_back(std::to_string(account_entry.rulesflag));
insert_values.push_back("'" + EscapeString(account_entry.suspendeduntil) + "'");
insert_values.push_back(std::to_string(account_entry.time_creation));
insert_values.push_back(std::to_string(account_entry.expansion));
insert_values.push_back("'" + EscapeString(account_entry.ban_reason) + "'");
insert_values.push_back("'" + EscapeString(account_entry.suspend_reason) + "'");
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
account_entry.id = results.LastInsertedID();
return account_entry;
}
account_entry = NewEntity();
return account_entry;
}
static int InsertMany(
std::vector<Account> account_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &account_entry: account_entries) {
std::vector<std::string> insert_values;
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));
insert_values.push_back("'" + EscapeString(account_entry.password) + "'");
insert_values.push_back(std::to_string(account_entry.status));
insert_values.push_back("'" + EscapeString(account_entry.ls_id) + "'");
insert_values.push_back(std::to_string(account_entry.lsaccount_id));
insert_values.push_back(std::to_string(account_entry.gmspeed));
insert_values.push_back(std::to_string(account_entry.revoked));
insert_values.push_back(std::to_string(account_entry.karma));
insert_values.push_back("'" + EscapeString(account_entry.minilogin_ip) + "'");
insert_values.push_back(std::to_string(account_entry.hideme));
insert_values.push_back(std::to_string(account_entry.rulesflag));
insert_values.push_back("'" + EscapeString(account_entry.suspendeduntil) + "'");
insert_values.push_back(std::to_string(account_entry.time_creation));
insert_values.push_back(std::to_string(account_entry.expansion));
insert_values.push_back("'" + EscapeString(account_entry.ban_reason) + "'");
insert_values.push_back("'" + EscapeString(account_entry.suspend_reason) + "'");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<Account> All()
{
std::vector<Account> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
Account entry{};
entry.id = atoi(row[0]);
entry.name = row[1] ? row[1] : "";
entry.charname = row[2] ? row[2] : "";
entry.sharedplat = atoi(row[3]);
entry.password = row[4] ? row[4] : "";
entry.status = atoi(row[5]);
entry.ls_id = row[6] ? row[6] : "";
entry.lsaccount_id = atoi(row[7]);
entry.gmspeed = atoi(row[8]);
entry.revoked = atoi(row[9]);
entry.karma = atoi(row[10]);
entry.minilogin_ip = row[11] ? row[11] : "";
entry.hideme = atoi(row[12]);
entry.rulesflag = atoi(row[13]);
entry.suspendeduntil = row[14] ? row[14] : "";
entry.time_creation = atoi(row[15]);
entry.expansion = atoi(row[16]);
entry.ban_reason = row[17] ? row[17] : "";
entry.suspend_reason = row[18] ? row[18] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<Account> GetWhere(std::string where_filter)
{
std::vector<Account> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
Account entry{};
entry.id = atoi(row[0]);
entry.name = row[1] ? row[1] : "";
entry.charname = row[2] ? row[2] : "";
entry.sharedplat = atoi(row[3]);
entry.password = row[4] ? row[4] : "";
entry.status = atoi(row[5]);
entry.ls_id = row[6] ? row[6] : "";
entry.lsaccount_id = atoi(row[7]);
entry.gmspeed = atoi(row[8]);
entry.revoked = atoi(row[9]);
entry.karma = atoi(row[10]);
entry.minilogin_ip = row[11] ? row[11] : "";
entry.hideme = atoi(row[12]);
entry.rulesflag = atoi(row[13]);
entry.suspendeduntil = row[14] ? row[14] : "";
entry.time_creation = atoi(row[15]);
entry.expansion = atoi(row[16]);
entry.ban_reason = row[17] ? row[17] : "";
entry.suspend_reason = row[18] ? row[18] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = database.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_ACCOUNT_REPOSITORY_H
@@ -0,0 +1,329 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_ACCOUNT_REWARDS_REPOSITORY_H
#define EQEMU_BASE_ACCOUNT_REWARDS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAccountRewardsRepository {
public:
struct AccountRewards {
int account_id;
int reward_id;
int amount;
};
static std::string PrimaryKey()
{
return std::string("account_id");
}
static std::vector<std::string> Columns()
{
return {
"account_id",
"reward_id",
"amount",
};
}
static std::string ColumnsRaw()
{
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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static AccountRewards NewEntity()
{
AccountRewards entry{};
entry.account_id = 0;
entry.reward_id = 0;
entry.amount = 0;
return entry;
}
static AccountRewards GetAccountRewardsEntry(
const std::vector<AccountRewards> &account_rewardss,
int account_rewards_id
)
{
for (auto &account_rewards : account_rewardss) {
if (account_rewards.account_id == account_rewards_id) {
return account_rewards;
}
}
return NewEntity();
}
static AccountRewards FindOne(
int account_rewards_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
account_rewards_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AccountRewards entry{};
entry.account_id = atoi(row[0]);
entry.reward_id = atoi(row[1]);
entry.amount = atoi(row[2]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int account_rewards_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
account_rewards_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
AccountRewards account_rewards_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(account_rewards_entry.account_id));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
account_rewards_entry.account_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AccountRewards InsertOne(
AccountRewards account_rewards_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(account_rewards_entry.account_id));
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
account_rewards_entry.account_id = results.LastInsertedID();
return account_rewards_entry;
}
account_rewards_entry = NewEntity();
return account_rewards_entry;
}
static int InsertMany(
std::vector<AccountRewards> account_rewards_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &account_rewards_entry: account_rewards_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(account_rewards_entry.account_id));
insert_values.push_back(std::to_string(account_rewards_entry.reward_id));
insert_values.push_back(std::to_string(account_rewards_entry.amount));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AccountRewards> All()
{
std::vector<AccountRewards> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AccountRewards entry{};
entry.account_id = atoi(row[0]);
entry.reward_id = atoi(row[1]);
entry.amount = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AccountRewards> GetWhere(std::string where_filter)
{
std::vector<AccountRewards> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AccountRewards entry{};
entry.account_id = atoi(row[0]);
entry.reward_id = atoi(row[1]);
entry.amount = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = database.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_ACCOUNT_REWARDS_REPOSITORY_H
@@ -0,0 +1,380 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_ADVENTURE_DETAILS_REPOSITORY_H
#define EQEMU_BASE_ADVENTURE_DETAILS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAdventureDetailsRepository {
public:
struct AdventureDetails {
int id;
int adventure_id;
int instance_id;
int count;
int assassinate_count;
int status;
int time_created;
int time_zoned;
int time_completed;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"adventure_id",
"instance_id",
"count",
"assassinate_count",
"status",
"time_created",
"time_zoned",
"time_completed",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string 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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static AdventureDetails NewEntity()
{
AdventureDetails entry{};
entry.id = 0;
entry.adventure_id = 0;
entry.instance_id = -1;
entry.count = 0;
entry.assassinate_count = 0;
entry.status = 0;
entry.time_created = 0;
entry.time_zoned = 0;
entry.time_completed = 0;
return entry;
}
static AdventureDetails GetAdventureDetailsEntry(
const std::vector<AdventureDetails> &adventure_detailss,
int adventure_details_id
)
{
for (auto &adventure_details : adventure_detailss) {
if (adventure_details.id == adventure_details_id) {
return adventure_details;
}
}
return NewEntity();
}
static AdventureDetails FindOne(
int adventure_details_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
adventure_details_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AdventureDetails entry{};
entry.id = atoi(row[0]);
entry.adventure_id = atoi(row[1]);
entry.instance_id = atoi(row[2]);
entry.count = atoi(row[3]);
entry.assassinate_count = atoi(row[4]);
entry.status = atoi(row[5]);
entry.time_created = atoi(row[6]);
entry.time_zoned = atoi(row[7]);
entry.time_completed = atoi(row[8]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int adventure_details_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
adventure_details_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
AdventureDetails adventure_details_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[1] + " = " + std::to_string(adventure_details_entry.adventure_id));
update_values.push_back(columns[2] + " = " + std::to_string(adventure_details_entry.instance_id));
update_values.push_back(columns[3] + " = " + std::to_string(adventure_details_entry.count));
update_values.push_back(columns[4] + " = " + std::to_string(adventure_details_entry.assassinate_count));
update_values.push_back(columns[5] + " = " + std::to_string(adventure_details_entry.status));
update_values.push_back(columns[6] + " = " + std::to_string(adventure_details_entry.time_created));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
adventure_details_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AdventureDetails InsertOne(
AdventureDetails adventure_details_entry
)
{
std::vector<std::string> insert_values;
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));
insert_values.push_back(std::to_string(adventure_details_entry.assassinate_count));
insert_values.push_back(std::to_string(adventure_details_entry.status));
insert_values.push_back(std::to_string(adventure_details_entry.time_created));
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
adventure_details_entry.id = results.LastInsertedID();
return adventure_details_entry;
}
adventure_details_entry = NewEntity();
return adventure_details_entry;
}
static int InsertMany(
std::vector<AdventureDetails> adventure_details_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &adventure_details_entry: adventure_details_entries) {
std::vector<std::string> insert_values;
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));
insert_values.push_back(std::to_string(adventure_details_entry.assassinate_count));
insert_values.push_back(std::to_string(adventure_details_entry.status));
insert_values.push_back(std::to_string(adventure_details_entry.time_created));
insert_values.push_back(std::to_string(adventure_details_entry.time_zoned));
insert_values.push_back(std::to_string(adventure_details_entry.time_completed));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AdventureDetails> All()
{
std::vector<AdventureDetails> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AdventureDetails entry{};
entry.id = atoi(row[0]);
entry.adventure_id = atoi(row[1]);
entry.instance_id = atoi(row[2]);
entry.count = atoi(row[3]);
entry.assassinate_count = atoi(row[4]);
entry.status = atoi(row[5]);
entry.time_created = atoi(row[6]);
entry.time_zoned = atoi(row[7]);
entry.time_completed = atoi(row[8]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AdventureDetails> GetWhere(std::string where_filter)
{
std::vector<AdventureDetails> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AdventureDetails entry{};
entry.id = atoi(row[0]);
entry.adventure_id = atoi(row[1]);
entry.instance_id = atoi(row[2]);
entry.count = atoi(row[3]);
entry.assassinate_count = atoi(row[4]);
entry.status = atoi(row[5]);
entry.time_created = atoi(row[6]);
entry.time_zoned = atoi(row[7]);
entry.time_completed = atoi(row[8]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = database.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_ADVENTURE_DETAILS_REPOSITORY_H
@@ -0,0 +1,320 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_ADVENTURE_MEMBERS_REPOSITORY_H
#define EQEMU_BASE_ADVENTURE_MEMBERS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAdventureMembersRepository {
public:
struct AdventureMembers {
int id;
int charid;
};
static std::string PrimaryKey()
{
return std::string("charid");
}
static std::vector<std::string> Columns()
{
return {
"id",
"charid",
};
}
static std::string ColumnsRaw()
{
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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static AdventureMembers NewEntity()
{
AdventureMembers entry{};
entry.id = 0;
entry.charid = 0;
return entry;
}
static AdventureMembers GetAdventureMembersEntry(
const std::vector<AdventureMembers> &adventure_memberss,
int adventure_members_id
)
{
for (auto &adventure_members : adventure_memberss) {
if (adventure_members.charid == adventure_members_id) {
return adventure_members;
}
}
return NewEntity();
}
static AdventureMembers FindOne(
int adventure_members_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
adventure_members_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AdventureMembers entry{};
entry.id = atoi(row[0]);
entry.charid = atoi(row[1]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int adventure_members_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
adventure_members_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
AdventureMembers adventure_members_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
adventure_members_entry.charid
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AdventureMembers InsertOne(
AdventureMembers adventure_members_entry
)
{
std::vector<std::string> insert_values;
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
adventure_members_entry.charid = results.LastInsertedID();
return adventure_members_entry;
}
adventure_members_entry = NewEntity();
return adventure_members_entry;
}
static int InsertMany(
std::vector<AdventureMembers> adventure_members_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &adventure_members_entry: adventure_members_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(adventure_members_entry.id));
insert_values.push_back(std::to_string(adventure_members_entry.charid));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AdventureMembers> All()
{
std::vector<AdventureMembers> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AdventureMembers entry{};
entry.id = atoi(row[0]);
entry.charid = atoi(row[1]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AdventureMembers> GetWhere(std::string where_filter)
{
std::vector<AdventureMembers> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AdventureMembers entry{};
entry.id = atoi(row[0]);
entry.charid = atoi(row[1]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = database.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_ADVENTURE_MEMBERS_REPOSITORY_H
@@ -0,0 +1,401 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_ADVENTURE_STATS_REPOSITORY_H
#define EQEMU_BASE_ADVENTURE_STATS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAdventureStatsRepository {
public:
struct AdventureStats {
int player_id;
int guk_wins;
int mir_wins;
int mmc_wins;
int ruj_wins;
int tak_wins;
int guk_losses;
int mir_losses;
int mmc_losses;
int ruj_losses;
int tak_losses;
};
static std::string PrimaryKey()
{
return std::string("player_id");
}
static std::vector<std::string> Columns()
{
return {
"player_id",
"guk_wins",
"mir_wins",
"mmc_wins",
"ruj_wins",
"tak_wins",
"guk_losses",
"mir_losses",
"mmc_losses",
"ruj_losses",
"tak_losses",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string 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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static AdventureStats NewEntity()
{
AdventureStats entry{};
entry.player_id = 0;
entry.guk_wins = 0;
entry.mir_wins = 0;
entry.mmc_wins = 0;
entry.ruj_wins = 0;
entry.tak_wins = 0;
entry.guk_losses = 0;
entry.mir_losses = 0;
entry.mmc_losses = 0;
entry.ruj_losses = 0;
entry.tak_losses = 0;
return entry;
}
static AdventureStats GetAdventureStatsEntry(
const std::vector<AdventureStats> &adventure_statss,
int adventure_stats_id
)
{
for (auto &adventure_stats : adventure_statss) {
if (adventure_stats.player_id == adventure_stats_id) {
return adventure_stats;
}
}
return NewEntity();
}
static AdventureStats FindOne(
int adventure_stats_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
adventure_stats_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AdventureStats entry{};
entry.player_id = atoi(row[0]);
entry.guk_wins = atoi(row[1]);
entry.mir_wins = atoi(row[2]);
entry.mmc_wins = atoi(row[3]);
entry.ruj_wins = atoi(row[4]);
entry.tak_wins = atoi(row[5]);
entry.guk_losses = atoi(row[6]);
entry.mir_losses = atoi(row[7]);
entry.mmc_losses = atoi(row[8]);
entry.ruj_losses = atoi(row[9]);
entry.tak_losses = atoi(row[10]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int adventure_stats_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
adventure_stats_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
AdventureStats adventure_stats_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(adventure_stats_entry.player_id));
update_values.push_back(columns[1] + " = " + std::to_string(adventure_stats_entry.guk_wins));
update_values.push_back(columns[2] + " = " + std::to_string(adventure_stats_entry.mir_wins));
update_values.push_back(columns[3] + " = " + std::to_string(adventure_stats_entry.mmc_wins));
update_values.push_back(columns[4] + " = " + std::to_string(adventure_stats_entry.ruj_wins));
update_values.push_back(columns[5] + " = " + std::to_string(adventure_stats_entry.tak_wins));
update_values.push_back(columns[6] + " = " + std::to_string(adventure_stats_entry.guk_losses));
update_values.push_back(columns[7] + " = " + std::to_string(adventure_stats_entry.mir_losses));
update_values.push_back(columns[8] + " = " + std::to_string(adventure_stats_entry.mmc_losses));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
adventure_stats_entry.player_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AdventureStats InsertOne(
AdventureStats adventure_stats_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(adventure_stats_entry.player_id));
insert_values.push_back(std::to_string(adventure_stats_entry.guk_wins));
insert_values.push_back(std::to_string(adventure_stats_entry.mir_wins));
insert_values.push_back(std::to_string(adventure_stats_entry.mmc_wins));
insert_values.push_back(std::to_string(adventure_stats_entry.ruj_wins));
insert_values.push_back(std::to_string(adventure_stats_entry.tak_wins));
insert_values.push_back(std::to_string(adventure_stats_entry.guk_losses));
insert_values.push_back(std::to_string(adventure_stats_entry.mir_losses));
insert_values.push_back(std::to_string(adventure_stats_entry.mmc_losses));
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
adventure_stats_entry.player_id = results.LastInsertedID();
return adventure_stats_entry;
}
adventure_stats_entry = NewEntity();
return adventure_stats_entry;
}
static int InsertMany(
std::vector<AdventureStats> adventure_stats_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &adventure_stats_entry: adventure_stats_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(adventure_stats_entry.player_id));
insert_values.push_back(std::to_string(adventure_stats_entry.guk_wins));
insert_values.push_back(std::to_string(adventure_stats_entry.mir_wins));
insert_values.push_back(std::to_string(adventure_stats_entry.mmc_wins));
insert_values.push_back(std::to_string(adventure_stats_entry.ruj_wins));
insert_values.push_back(std::to_string(adventure_stats_entry.tak_wins));
insert_values.push_back(std::to_string(adventure_stats_entry.guk_losses));
insert_values.push_back(std::to_string(adventure_stats_entry.mir_losses));
insert_values.push_back(std::to_string(adventure_stats_entry.mmc_losses));
insert_values.push_back(std::to_string(adventure_stats_entry.ruj_losses));
insert_values.push_back(std::to_string(adventure_stats_entry.tak_losses));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AdventureStats> All()
{
std::vector<AdventureStats> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AdventureStats entry{};
entry.player_id = atoi(row[0]);
entry.guk_wins = atoi(row[1]);
entry.mir_wins = atoi(row[2]);
entry.mmc_wins = atoi(row[3]);
entry.ruj_wins = atoi(row[4]);
entry.tak_wins = atoi(row[5]);
entry.guk_losses = atoi(row[6]);
entry.mir_losses = atoi(row[7]);
entry.mmc_losses = atoi(row[8]);
entry.ruj_losses = atoi(row[9]);
entry.tak_losses = atoi(row[10]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AdventureStats> GetWhere(std::string where_filter)
{
std::vector<AdventureStats> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AdventureStats entry{};
entry.player_id = atoi(row[0]);
entry.guk_wins = atoi(row[1]);
entry.mir_wins = atoi(row[2]);
entry.mmc_wins = atoi(row[3]);
entry.ruj_wins = atoi(row[4]);
entry.tak_wins = atoi(row[5]);
entry.guk_losses = atoi(row[6]);
entry.mir_losses = atoi(row[7]);
entry.mmc_losses = atoi(row[8]);
entry.ruj_losses = atoi(row[9]);
entry.tak_losses = atoi(row[10]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = database.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_ADVENTURE_STATS_REPOSITORY_H
@@ -0,0 +1,320 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_ADVENTURE_TEMPLATE_ENTRY_FLAVOR_REPOSITORY_H
#define EQEMU_BASE_ADVENTURE_TEMPLATE_ENTRY_FLAVOR_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAdventureTemplateEntryFlavorRepository {
public:
struct AdventureTemplateEntryFlavor {
int id;
std::string text;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"text",
};
}
static std::string ColumnsRaw()
{
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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static AdventureTemplateEntryFlavor NewEntity()
{
AdventureTemplateEntryFlavor entry{};
entry.id = 0;
entry.text = "";
return entry;
}
static AdventureTemplateEntryFlavor GetAdventureTemplateEntryFlavorEntry(
const std::vector<AdventureTemplateEntryFlavor> &adventure_template_entry_flavors,
int adventure_template_entry_flavor_id
)
{
for (auto &adventure_template_entry_flavor : adventure_template_entry_flavors) {
if (adventure_template_entry_flavor.id == adventure_template_entry_flavor_id) {
return adventure_template_entry_flavor;
}
}
return NewEntity();
}
static AdventureTemplateEntryFlavor FindOne(
int adventure_template_entry_flavor_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
adventure_template_entry_flavor_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AdventureTemplateEntryFlavor entry{};
entry.id = atoi(row[0]);
entry.text = row[1] ? row[1] : "";
return entry;
}
return NewEntity();
}
static int DeleteOne(
int adventure_template_entry_flavor_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
adventure_template_entry_flavor_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
AdventureTemplateEntryFlavor adventure_template_entry_flavor_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
adventure_template_entry_flavor_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AdventureTemplateEntryFlavor InsertOne(
AdventureTemplateEntryFlavor adventure_template_entry_flavor_entry
)
{
std::vector<std::string> insert_values;
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
adventure_template_entry_flavor_entry.id = results.LastInsertedID();
return adventure_template_entry_flavor_entry;
}
adventure_template_entry_flavor_entry = NewEntity();
return adventure_template_entry_flavor_entry;
}
static int InsertMany(
std::vector<AdventureTemplateEntryFlavor> adventure_template_entry_flavor_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &adventure_template_entry_flavor_entry: adventure_template_entry_flavor_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(adventure_template_entry_flavor_entry.id));
insert_values.push_back("'" + EscapeString(adventure_template_entry_flavor_entry.text) + "'");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AdventureTemplateEntryFlavor> All()
{
std::vector<AdventureTemplateEntryFlavor> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AdventureTemplateEntryFlavor entry{};
entry.id = atoi(row[0]);
entry.text = row[1] ? row[1] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AdventureTemplateEntryFlavor> GetWhere(std::string where_filter)
{
std::vector<AdventureTemplateEntryFlavor> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AdventureTemplateEntryFlavor entry{};
entry.id = atoi(row[0]);
entry.text = row[1] ? row[1] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = content_db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_ADVENTURE_TEMPLATE_ENTRY_FLAVOR_REPOSITORY_H
@@ -0,0 +1,320 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_ADVENTURE_TEMPLATE_ENTRY_REPOSITORY_H
#define EQEMU_BASE_ADVENTURE_TEMPLATE_ENTRY_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAdventureTemplateEntryRepository {
public:
struct AdventureTemplateEntry {
int id;
int template_id;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"template_id",
};
}
static std::string ColumnsRaw()
{
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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static AdventureTemplateEntry NewEntity()
{
AdventureTemplateEntry entry{};
entry.id = 0;
entry.template_id = 0;
return entry;
}
static AdventureTemplateEntry GetAdventureTemplateEntryEntry(
const std::vector<AdventureTemplateEntry> &adventure_template_entrys,
int adventure_template_entry_id
)
{
for (auto &adventure_template_entry : adventure_template_entrys) {
if (adventure_template_entry.id == adventure_template_entry_id) {
return adventure_template_entry;
}
}
return NewEntity();
}
static AdventureTemplateEntry FindOne(
int adventure_template_entry_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
adventure_template_entry_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AdventureTemplateEntry entry{};
entry.id = atoi(row[0]);
entry.template_id = atoi(row[1]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int adventure_template_entry_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
adventure_template_entry_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
AdventureTemplateEntry adventure_template_entry_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
adventure_template_entry_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AdventureTemplateEntry InsertOne(
AdventureTemplateEntry adventure_template_entry_entry
)
{
std::vector<std::string> insert_values;
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
adventure_template_entry_entry.id = results.LastInsertedID();
return adventure_template_entry_entry;
}
adventure_template_entry_entry = NewEntity();
return adventure_template_entry_entry;
}
static int InsertMany(
std::vector<AdventureTemplateEntry> adventure_template_entry_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &adventure_template_entry_entry: adventure_template_entry_entries) {
std::vector<std::string> insert_values;
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));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AdventureTemplateEntry> All()
{
std::vector<AdventureTemplateEntry> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AdventureTemplateEntry entry{};
entry.id = atoi(row[0]);
entry.template_id = atoi(row[1]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AdventureTemplateEntry> GetWhere(std::string where_filter)
{
std::vector<AdventureTemplateEntry> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AdventureTemplateEntry entry{};
entry.id = atoi(row[0]);
entry.template_id = atoi(row[1]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = content_db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_ADVENTURE_TEMPLATE_ENTRY_REPOSITORY_H
@@ -0,0 +1,599 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_ADVENTURE_TEMPLATE_REPOSITORY_H
#define EQEMU_BASE_ADVENTURE_TEMPLATE_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAdventureTemplateRepository {
public:
struct AdventureTemplate {
int id;
std::string zone;
int zone_version;
int is_hard;
int is_raid;
int min_level;
int max_level;
int type;
int type_data;
int type_count;
float assa_x;
float assa_y;
float assa_z;
float assa_h;
std::string text;
int duration;
int zone_in_time;
int win_points;
int lose_points;
int theme;
int zone_in_zone_id;
float zone_in_x;
float zone_in_y;
int zone_in_object_id;
float dest_x;
float dest_y;
float dest_z;
float dest_h;
int graveyard_zone_id;
float graveyard_x;
float graveyard_y;
float graveyard_z;
float graveyard_radius;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"zone",
"zone_version",
"is_hard",
"is_raid",
"min_level",
"max_level",
"type",
"type_data",
"type_count",
"assa_x",
"assa_y",
"assa_z",
"assa_h",
"text",
"duration",
"zone_in_time",
"win_points",
"lose_points",
"theme",
"zone_in_zone_id",
"zone_in_x",
"zone_in_y",
"zone_in_object_id",
"dest_x",
"dest_y",
"dest_z",
"dest_h",
"graveyard_zone_id",
"graveyard_x",
"graveyard_y",
"graveyard_z",
"graveyard_radius",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string 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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static AdventureTemplate NewEntity()
{
AdventureTemplate entry{};
entry.id = 0;
entry.zone = "";
entry.zone_version = 0;
entry.is_hard = 0;
entry.is_raid = 0;
entry.min_level = 1;
entry.max_level = 65;
entry.type = 0;
entry.type_data = 0;
entry.type_count = 0;
entry.assa_x = 0;
entry.assa_y = 0;
entry.assa_z = 0;
entry.assa_h = 0;
entry.text = "";
entry.duration = 7200;
entry.zone_in_time = 1800;
entry.win_points = 0;
entry.lose_points = 0;
entry.theme = 1;
entry.zone_in_zone_id = 0;
entry.zone_in_x = 0;
entry.zone_in_y = 0;
entry.zone_in_object_id = 0;
entry.dest_x = 0;
entry.dest_y = 0;
entry.dest_z = 0;
entry.dest_h = 0;
entry.graveyard_zone_id = 0;
entry.graveyard_x = 0;
entry.graveyard_y = 0;
entry.graveyard_z = 0;
entry.graveyard_radius = 0;
return entry;
}
static AdventureTemplate GetAdventureTemplateEntry(
const std::vector<AdventureTemplate> &adventure_templates,
int adventure_template_id
)
{
for (auto &adventure_template : adventure_templates) {
if (adventure_template.id == adventure_template_id) {
return adventure_template;
}
}
return NewEntity();
}
static AdventureTemplate FindOne(
int adventure_template_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
adventure_template_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AdventureTemplate entry{};
entry.id = atoi(row[0]);
entry.zone = row[1] ? row[1] : "";
entry.zone_version = atoi(row[2]);
entry.is_hard = atoi(row[3]);
entry.is_raid = atoi(row[4]);
entry.min_level = atoi(row[5]);
entry.max_level = atoi(row[6]);
entry.type = atoi(row[7]);
entry.type_data = atoi(row[8]);
entry.type_count = atoi(row[9]);
entry.assa_x = static_cast<float>(atof(row[10]));
entry.assa_y = static_cast<float>(atof(row[11]));
entry.assa_z = static_cast<float>(atof(row[12]));
entry.assa_h = static_cast<float>(atof(row[13]));
entry.text = row[14] ? row[14] : "";
entry.duration = atoi(row[15]);
entry.zone_in_time = atoi(row[16]);
entry.win_points = atoi(row[17]);
entry.lose_points = atoi(row[18]);
entry.theme = atoi(row[19]);
entry.zone_in_zone_id = atoi(row[20]);
entry.zone_in_x = static_cast<float>(atof(row[21]));
entry.zone_in_y = static_cast<float>(atof(row[22]));
entry.zone_in_object_id = atoi(row[23]);
entry.dest_x = static_cast<float>(atof(row[24]));
entry.dest_y = static_cast<float>(atof(row[25]));
entry.dest_z = static_cast<float>(atof(row[26]));
entry.dest_h = static_cast<float>(atof(row[27]));
entry.graveyard_zone_id = atoi(row[28]);
entry.graveyard_x = static_cast<float>(atof(row[29]));
entry.graveyard_y = static_cast<float>(atof(row[30]));
entry.graveyard_z = static_cast<float>(atof(row[31]));
entry.graveyard_radius = static_cast<float>(atof(row[32]));
return entry;
}
return NewEntity();
}
static int DeleteOne(
int adventure_template_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
adventure_template_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
AdventureTemplate adventure_template_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(adventure_template_entry.id));
update_values.push_back(columns[1] + " = '" + EscapeString(adventure_template_entry.zone) + "'");
update_values.push_back(columns[2] + " = " + std::to_string(adventure_template_entry.zone_version));
update_values.push_back(columns[3] + " = " + std::to_string(adventure_template_entry.is_hard));
update_values.push_back(columns[4] + " = " + std::to_string(adventure_template_entry.is_raid));
update_values.push_back(columns[5] + " = " + std::to_string(adventure_template_entry.min_level));
update_values.push_back(columns[6] + " = " + std::to_string(adventure_template_entry.max_level));
update_values.push_back(columns[7] + " = " + std::to_string(adventure_template_entry.type));
update_values.push_back(columns[8] + " = " + std::to_string(adventure_template_entry.type_data));
update_values.push_back(columns[9] + " = " + std::to_string(adventure_template_entry.type_count));
update_values.push_back(columns[10] + " = " + std::to_string(adventure_template_entry.assa_x));
update_values.push_back(columns[11] + " = " + std::to_string(adventure_template_entry.assa_y));
update_values.push_back(columns[12] + " = " + std::to_string(adventure_template_entry.assa_z));
update_values.push_back(columns[13] + " = " + std::to_string(adventure_template_entry.assa_h));
update_values.push_back(columns[14] + " = '" + EscapeString(adventure_template_entry.text) + "'");
update_values.push_back(columns[15] + " = " + std::to_string(adventure_template_entry.duration));
update_values.push_back(columns[16] + " = " + std::to_string(adventure_template_entry.zone_in_time));
update_values.push_back(columns[17] + " = " + std::to_string(adventure_template_entry.win_points));
update_values.push_back(columns[18] + " = " + std::to_string(adventure_template_entry.lose_points));
update_values.push_back(columns[19] + " = " + std::to_string(adventure_template_entry.theme));
update_values.push_back(columns[20] + " = " + std::to_string(adventure_template_entry.zone_in_zone_id));
update_values.push_back(columns[21] + " = " + std::to_string(adventure_template_entry.zone_in_x));
update_values.push_back(columns[22] + " = " + std::to_string(adventure_template_entry.zone_in_y));
update_values.push_back(columns[23] + " = " + std::to_string(adventure_template_entry.zone_in_object_id));
update_values.push_back(columns[24] + " = " + std::to_string(adventure_template_entry.dest_x));
update_values.push_back(columns[25] + " = " + std::to_string(adventure_template_entry.dest_y));
update_values.push_back(columns[26] + " = " + std::to_string(adventure_template_entry.dest_z));
update_values.push_back(columns[27] + " = " + std::to_string(adventure_template_entry.dest_h));
update_values.push_back(columns[28] + " = " + std::to_string(adventure_template_entry.graveyard_zone_id));
update_values.push_back(columns[29] + " = " + std::to_string(adventure_template_entry.graveyard_x));
update_values.push_back(columns[30] + " = " + std::to_string(adventure_template_entry.graveyard_y));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
adventure_template_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AdventureTemplate InsertOne(
AdventureTemplate adventure_template_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(adventure_template_entry.id));
insert_values.push_back("'" + EscapeString(adventure_template_entry.zone) + "'");
insert_values.push_back(std::to_string(adventure_template_entry.zone_version));
insert_values.push_back(std::to_string(adventure_template_entry.is_hard));
insert_values.push_back(std::to_string(adventure_template_entry.is_raid));
insert_values.push_back(std::to_string(adventure_template_entry.min_level));
insert_values.push_back(std::to_string(adventure_template_entry.max_level));
insert_values.push_back(std::to_string(adventure_template_entry.type));
insert_values.push_back(std::to_string(adventure_template_entry.type_data));
insert_values.push_back(std::to_string(adventure_template_entry.type_count));
insert_values.push_back(std::to_string(adventure_template_entry.assa_x));
insert_values.push_back(std::to_string(adventure_template_entry.assa_y));
insert_values.push_back(std::to_string(adventure_template_entry.assa_z));
insert_values.push_back(std::to_string(adventure_template_entry.assa_h));
insert_values.push_back("'" + EscapeString(adventure_template_entry.text) + "'");
insert_values.push_back(std::to_string(adventure_template_entry.duration));
insert_values.push_back(std::to_string(adventure_template_entry.zone_in_time));
insert_values.push_back(std::to_string(adventure_template_entry.win_points));
insert_values.push_back(std::to_string(adventure_template_entry.lose_points));
insert_values.push_back(std::to_string(adventure_template_entry.theme));
insert_values.push_back(std::to_string(adventure_template_entry.zone_in_zone_id));
insert_values.push_back(std::to_string(adventure_template_entry.zone_in_x));
insert_values.push_back(std::to_string(adventure_template_entry.zone_in_y));
insert_values.push_back(std::to_string(adventure_template_entry.zone_in_object_id));
insert_values.push_back(std::to_string(adventure_template_entry.dest_x));
insert_values.push_back(std::to_string(adventure_template_entry.dest_y));
insert_values.push_back(std::to_string(adventure_template_entry.dest_z));
insert_values.push_back(std::to_string(adventure_template_entry.dest_h));
insert_values.push_back(std::to_string(adventure_template_entry.graveyard_zone_id));
insert_values.push_back(std::to_string(adventure_template_entry.graveyard_x));
insert_values.push_back(std::to_string(adventure_template_entry.graveyard_y));
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
adventure_template_entry.id = results.LastInsertedID();
return adventure_template_entry;
}
adventure_template_entry = NewEntity();
return adventure_template_entry;
}
static int InsertMany(
std::vector<AdventureTemplate> adventure_template_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &adventure_template_entry: adventure_template_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(adventure_template_entry.id));
insert_values.push_back("'" + EscapeString(adventure_template_entry.zone) + "'");
insert_values.push_back(std::to_string(adventure_template_entry.zone_version));
insert_values.push_back(std::to_string(adventure_template_entry.is_hard));
insert_values.push_back(std::to_string(adventure_template_entry.is_raid));
insert_values.push_back(std::to_string(adventure_template_entry.min_level));
insert_values.push_back(std::to_string(adventure_template_entry.max_level));
insert_values.push_back(std::to_string(adventure_template_entry.type));
insert_values.push_back(std::to_string(adventure_template_entry.type_data));
insert_values.push_back(std::to_string(adventure_template_entry.type_count));
insert_values.push_back(std::to_string(adventure_template_entry.assa_x));
insert_values.push_back(std::to_string(adventure_template_entry.assa_y));
insert_values.push_back(std::to_string(adventure_template_entry.assa_z));
insert_values.push_back(std::to_string(adventure_template_entry.assa_h));
insert_values.push_back("'" + EscapeString(adventure_template_entry.text) + "'");
insert_values.push_back(std::to_string(adventure_template_entry.duration));
insert_values.push_back(std::to_string(adventure_template_entry.zone_in_time));
insert_values.push_back(std::to_string(adventure_template_entry.win_points));
insert_values.push_back(std::to_string(adventure_template_entry.lose_points));
insert_values.push_back(std::to_string(adventure_template_entry.theme));
insert_values.push_back(std::to_string(adventure_template_entry.zone_in_zone_id));
insert_values.push_back(std::to_string(adventure_template_entry.zone_in_x));
insert_values.push_back(std::to_string(adventure_template_entry.zone_in_y));
insert_values.push_back(std::to_string(adventure_template_entry.zone_in_object_id));
insert_values.push_back(std::to_string(adventure_template_entry.dest_x));
insert_values.push_back(std::to_string(adventure_template_entry.dest_y));
insert_values.push_back(std::to_string(adventure_template_entry.dest_z));
insert_values.push_back(std::to_string(adventure_template_entry.dest_h));
insert_values.push_back(std::to_string(adventure_template_entry.graveyard_zone_id));
insert_values.push_back(std::to_string(adventure_template_entry.graveyard_x));
insert_values.push_back(std::to_string(adventure_template_entry.graveyard_y));
insert_values.push_back(std::to_string(adventure_template_entry.graveyard_z));
insert_values.push_back(std::to_string(adventure_template_entry.graveyard_radius));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AdventureTemplate> All()
{
std::vector<AdventureTemplate> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AdventureTemplate entry{};
entry.id = atoi(row[0]);
entry.zone = row[1] ? row[1] : "";
entry.zone_version = atoi(row[2]);
entry.is_hard = atoi(row[3]);
entry.is_raid = atoi(row[4]);
entry.min_level = atoi(row[5]);
entry.max_level = atoi(row[6]);
entry.type = atoi(row[7]);
entry.type_data = atoi(row[8]);
entry.type_count = atoi(row[9]);
entry.assa_x = static_cast<float>(atof(row[10]));
entry.assa_y = static_cast<float>(atof(row[11]));
entry.assa_z = static_cast<float>(atof(row[12]));
entry.assa_h = static_cast<float>(atof(row[13]));
entry.text = row[14] ? row[14] : "";
entry.duration = atoi(row[15]);
entry.zone_in_time = atoi(row[16]);
entry.win_points = atoi(row[17]);
entry.lose_points = atoi(row[18]);
entry.theme = atoi(row[19]);
entry.zone_in_zone_id = atoi(row[20]);
entry.zone_in_x = static_cast<float>(atof(row[21]));
entry.zone_in_y = static_cast<float>(atof(row[22]));
entry.zone_in_object_id = atoi(row[23]);
entry.dest_x = static_cast<float>(atof(row[24]));
entry.dest_y = static_cast<float>(atof(row[25]));
entry.dest_z = static_cast<float>(atof(row[26]));
entry.dest_h = static_cast<float>(atof(row[27]));
entry.graveyard_zone_id = atoi(row[28]);
entry.graveyard_x = static_cast<float>(atof(row[29]));
entry.graveyard_y = static_cast<float>(atof(row[30]));
entry.graveyard_z = static_cast<float>(atof(row[31]));
entry.graveyard_radius = static_cast<float>(atof(row[32]));
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AdventureTemplate> GetWhere(std::string where_filter)
{
std::vector<AdventureTemplate> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AdventureTemplate entry{};
entry.id = atoi(row[0]);
entry.zone = row[1] ? row[1] : "";
entry.zone_version = atoi(row[2]);
entry.is_hard = atoi(row[3]);
entry.is_raid = atoi(row[4]);
entry.min_level = atoi(row[5]);
entry.max_level = atoi(row[6]);
entry.type = atoi(row[7]);
entry.type_data = atoi(row[8]);
entry.type_count = atoi(row[9]);
entry.assa_x = static_cast<float>(atof(row[10]));
entry.assa_y = static_cast<float>(atof(row[11]));
entry.assa_z = static_cast<float>(atof(row[12]));
entry.assa_h = static_cast<float>(atof(row[13]));
entry.text = row[14] ? row[14] : "";
entry.duration = atoi(row[15]);
entry.zone_in_time = atoi(row[16]);
entry.win_points = atoi(row[17]);
entry.lose_points = atoi(row[18]);
entry.theme = atoi(row[19]);
entry.zone_in_zone_id = atoi(row[20]);
entry.zone_in_x = static_cast<float>(atof(row[21]));
entry.zone_in_y = static_cast<float>(atof(row[22]));
entry.zone_in_object_id = atoi(row[23]);
entry.dest_x = static_cast<float>(atof(row[24]));
entry.dest_y = static_cast<float>(atof(row[25]));
entry.dest_z = static_cast<float>(atof(row[26]));
entry.dest_h = static_cast<float>(atof(row[27]));
entry.graveyard_zone_id = atoi(row[28]);
entry.graveyard_x = static_cast<float>(atof(row[29]));
entry.graveyard_y = static_cast<float>(atof(row[30]));
entry.graveyard_z = static_cast<float>(atof(row[31]));
entry.graveyard_radius = static_cast<float>(atof(row[32]));
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = content_db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_ADVENTURE_TEMPLATE_REPOSITORY_H
@@ -0,0 +1,320 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_ALTERNATE_CURRENCY_REPOSITORY_H
#define EQEMU_BASE_ALTERNATE_CURRENCY_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAlternateCurrencyRepository {
public:
struct AlternateCurrency {
int id;
int item_id;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"item_id",
};
}
static std::string ColumnsRaw()
{
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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static AlternateCurrency NewEntity()
{
AlternateCurrency entry{};
entry.id = 0;
entry.item_id = 0;
return entry;
}
static AlternateCurrency GetAlternateCurrencyEntry(
const std::vector<AlternateCurrency> &alternate_currencys,
int alternate_currency_id
)
{
for (auto &alternate_currency : alternate_currencys) {
if (alternate_currency.id == alternate_currency_id) {
return alternate_currency;
}
}
return NewEntity();
}
static AlternateCurrency FindOne(
int alternate_currency_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
alternate_currency_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AlternateCurrency entry{};
entry.id = atoi(row[0]);
entry.item_id = atoi(row[1]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int alternate_currency_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
alternate_currency_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
AlternateCurrency alternate_currency_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
alternate_currency_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AlternateCurrency InsertOne(
AlternateCurrency alternate_currency_entry
)
{
std::vector<std::string> insert_values;
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
alternate_currency_entry.id = results.LastInsertedID();
return alternate_currency_entry;
}
alternate_currency_entry = NewEntity();
return alternate_currency_entry;
}
static int InsertMany(
std::vector<AlternateCurrency> alternate_currency_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &alternate_currency_entry: alternate_currency_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(alternate_currency_entry.id));
insert_values.push_back(std::to_string(alternate_currency_entry.item_id));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AlternateCurrency> All()
{
std::vector<AlternateCurrency> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AlternateCurrency entry{};
entry.id = atoi(row[0]);
entry.item_id = atoi(row[1]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AlternateCurrency> GetWhere(std::string where_filter)
{
std::vector<AlternateCurrency> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AlternateCurrency entry{};
entry.id = atoi(row[0]);
entry.item_id = atoi(row[1]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = content_db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_ALTERNATE_CURRENCY_REPOSITORY_H
@@ -0,0 +1,401 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_AURAS_REPOSITORY_H
#define EQEMU_BASE_AURAS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAurasRepository {
public:
struct Auras {
int type;
int npc_type;
std::string name;
int spell_id;
int distance;
int aura_type;
int spawn_type;
int movement;
int duration;
int icon;
int cast_time;
};
static std::string PrimaryKey()
{
return std::string("type");
}
static std::vector<std::string> Columns()
{
return {
"type",
"npc_type",
"name",
"spell_id",
"distance",
"aura_type",
"spawn_type",
"movement",
"duration",
"icon",
"cast_time",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string 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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static Auras NewEntity()
{
Auras entry{};
entry.type = 0;
entry.npc_type = 0;
entry.name = "";
entry.spell_id = 0;
entry.distance = 60;
entry.aura_type = 1;
entry.spawn_type = 0;
entry.movement = 0;
entry.duration = 5400;
entry.icon = -1;
entry.cast_time = 0;
return entry;
}
static Auras GetAurasEntry(
const std::vector<Auras> &aurass,
int auras_id
)
{
for (auto &auras : aurass) {
if (auras.type == auras_id) {
return auras;
}
}
return NewEntity();
}
static Auras FindOne(
int auras_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
auras_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
Auras entry{};
entry.type = atoi(row[0]);
entry.npc_type = atoi(row[1]);
entry.name = row[2] ? row[2] : "";
entry.spell_id = atoi(row[3]);
entry.distance = atoi(row[4]);
entry.aura_type = atoi(row[5]);
entry.spawn_type = atoi(row[6]);
entry.movement = atoi(row[7]);
entry.duration = atoi(row[8]);
entry.icon = atoi(row[9]);
entry.cast_time = atoi(row[10]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int auras_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
auras_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Auras auras_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(auras_entry.type));
update_values.push_back(columns[1] + " = " + std::to_string(auras_entry.npc_type));
update_values.push_back(columns[2] + " = '" + EscapeString(auras_entry.name) + "'");
update_values.push_back(columns[3] + " = " + std::to_string(auras_entry.spell_id));
update_values.push_back(columns[4] + " = " + std::to_string(auras_entry.distance));
update_values.push_back(columns[5] + " = " + std::to_string(auras_entry.aura_type));
update_values.push_back(columns[6] + " = " + std::to_string(auras_entry.spawn_type));
update_values.push_back(columns[7] + " = " + std::to_string(auras_entry.movement));
update_values.push_back(columns[8] + " = " + std::to_string(auras_entry.duration));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
auras_entry.type
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static Auras InsertOne(
Auras auras_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(auras_entry.type));
insert_values.push_back(std::to_string(auras_entry.npc_type));
insert_values.push_back("'" + EscapeString(auras_entry.name) + "'");
insert_values.push_back(std::to_string(auras_entry.spell_id));
insert_values.push_back(std::to_string(auras_entry.distance));
insert_values.push_back(std::to_string(auras_entry.aura_type));
insert_values.push_back(std::to_string(auras_entry.spawn_type));
insert_values.push_back(std::to_string(auras_entry.movement));
insert_values.push_back(std::to_string(auras_entry.duration));
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
auras_entry.type = results.LastInsertedID();
return auras_entry;
}
auras_entry = NewEntity();
return auras_entry;
}
static int InsertMany(
std::vector<Auras> auras_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &auras_entry: auras_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(auras_entry.type));
insert_values.push_back(std::to_string(auras_entry.npc_type));
insert_values.push_back("'" + EscapeString(auras_entry.name) + "'");
insert_values.push_back(std::to_string(auras_entry.spell_id));
insert_values.push_back(std::to_string(auras_entry.distance));
insert_values.push_back(std::to_string(auras_entry.aura_type));
insert_values.push_back(std::to_string(auras_entry.spawn_type));
insert_values.push_back(std::to_string(auras_entry.movement));
insert_values.push_back(std::to_string(auras_entry.duration));
insert_values.push_back(std::to_string(auras_entry.icon));
insert_values.push_back(std::to_string(auras_entry.cast_time));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<Auras> All()
{
std::vector<Auras> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
Auras entry{};
entry.type = atoi(row[0]);
entry.npc_type = atoi(row[1]);
entry.name = row[2] ? row[2] : "";
entry.spell_id = atoi(row[3]);
entry.distance = atoi(row[4]);
entry.aura_type = atoi(row[5]);
entry.spawn_type = atoi(row[6]);
entry.movement = atoi(row[7]);
entry.duration = atoi(row[8]);
entry.icon = atoi(row[9]);
entry.cast_time = atoi(row[10]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<Auras> GetWhere(std::string where_filter)
{
std::vector<Auras> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
Auras entry{};
entry.type = atoi(row[0]);
entry.npc_type = atoi(row[1]);
entry.name = row[2] ? row[2] : "";
entry.spell_id = atoi(row[3]);
entry.distance = atoi(row[4]);
entry.aura_type = atoi(row[5]);
entry.spawn_type = atoi(row[6]);
entry.movement = atoi(row[7]);
entry.duration = atoi(row[8]);
entry.icon = atoi(row[9]);
entry.cast_time = atoi(row[10]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = content_db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_AURAS_REPOSITORY_H
@@ -0,0 +1,392 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_BASE_DATA_REPOSITORY_H
#define EQEMU_BASE_BASE_DATA_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseBaseDataRepository {
public:
struct BaseData {
int level;
int class;
float hp;
float mana;
float end;
float unk1;
float unk2;
float hp_fac;
float mana_fac;
float end_fac;
};
static std::string PrimaryKey()
{
return std::string("level");
}
static std::vector<std::string> Columns()
{
return {
"level",
"class",
"hp",
"mana",
"end",
"unk1",
"unk2",
"hp_fac",
"mana_fac",
"end_fac",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string 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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static BaseData NewEntity()
{
BaseData entry{};
entry.level = 0;
entry.class = 0;
entry.hp = 0;
entry.mana = 0;
entry.end = 0;
entry.unk1 = 0;
entry.unk2 = 0;
entry.hp_fac = 0;
entry.mana_fac = 0;
entry.end_fac = 0;
return entry;
}
static BaseData GetBaseDataEntry(
const std::vector<BaseData> &base_datas,
int base_data_id
)
{
for (auto &base_data : base_datas) {
if (base_data.level == base_data_id) {
return base_data;
}
}
return NewEntity();
}
static BaseData FindOne(
int base_data_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
base_data_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
BaseData entry{};
entry.level = atoi(row[0]);
entry.class = atoi(row[1]);
entry.hp = static_cast<float>(atof(row[2]));
entry.mana = static_cast<float>(atof(row[3]));
entry.end = static_cast<float>(atof(row[4]));
entry.unk1 = static_cast<float>(atof(row[5]));
entry.unk2 = static_cast<float>(atof(row[6]));
entry.hp_fac = static_cast<float>(atof(row[7]));
entry.mana_fac = static_cast<float>(atof(row[8]));
entry.end_fac = static_cast<float>(atof(row[9]));
return entry;
}
return NewEntity();
}
static int DeleteOne(
int base_data_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
base_data_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
BaseData base_data_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(base_data_entry.level));
update_values.push_back(columns[1] + " = " + std::to_string(base_data_entry.class));
update_values.push_back(columns[2] + " = " + std::to_string(base_data_entry.hp));
update_values.push_back(columns[3] + " = " + std::to_string(base_data_entry.mana));
update_values.push_back(columns[4] + " = " + std::to_string(base_data_entry.end));
update_values.push_back(columns[5] + " = " + std::to_string(base_data_entry.unk1));
update_values.push_back(columns[6] + " = " + std::to_string(base_data_entry.unk2));
update_values.push_back(columns[7] + " = " + std::to_string(base_data_entry.hp_fac));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
base_data_entry.level
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static BaseData InsertOne(
BaseData base_data_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(base_data_entry.level));
insert_values.push_back(std::to_string(base_data_entry.class));
insert_values.push_back(std::to_string(base_data_entry.hp));
insert_values.push_back(std::to_string(base_data_entry.mana));
insert_values.push_back(std::to_string(base_data_entry.end));
insert_values.push_back(std::to_string(base_data_entry.unk1));
insert_values.push_back(std::to_string(base_data_entry.unk2));
insert_values.push_back(std::to_string(base_data_entry.hp_fac));
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
base_data_entry.level = results.LastInsertedID();
return base_data_entry;
}
base_data_entry = NewEntity();
return base_data_entry;
}
static int InsertMany(
std::vector<BaseData> base_data_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &base_data_entry: base_data_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(base_data_entry.level));
insert_values.push_back(std::to_string(base_data_entry.class));
insert_values.push_back(std::to_string(base_data_entry.hp));
insert_values.push_back(std::to_string(base_data_entry.mana));
insert_values.push_back(std::to_string(base_data_entry.end));
insert_values.push_back(std::to_string(base_data_entry.unk1));
insert_values.push_back(std::to_string(base_data_entry.unk2));
insert_values.push_back(std::to_string(base_data_entry.hp_fac));
insert_values.push_back(std::to_string(base_data_entry.mana_fac));
insert_values.push_back(std::to_string(base_data_entry.end_fac));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<BaseData> All()
{
std::vector<BaseData> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
BaseData entry{};
entry.level = atoi(row[0]);
entry.class = atoi(row[1]);
entry.hp = static_cast<float>(atof(row[2]));
entry.mana = static_cast<float>(atof(row[3]));
entry.end = static_cast<float>(atof(row[4]));
entry.unk1 = static_cast<float>(atof(row[5]));
entry.unk2 = static_cast<float>(atof(row[6]));
entry.hp_fac = static_cast<float>(atof(row[7]));
entry.mana_fac = static_cast<float>(atof(row[8]));
entry.end_fac = static_cast<float>(atof(row[9]));
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<BaseData> GetWhere(std::string where_filter)
{
std::vector<BaseData> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
BaseData entry{};
entry.level = atoi(row[0]);
entry.class = atoi(row[1]);
entry.hp = static_cast<float>(atof(row[2]));
entry.mana = static_cast<float>(atof(row[3]));
entry.end = static_cast<float>(atof(row[4]));
entry.unk1 = static_cast<float>(atof(row[5]));
entry.unk2 = static_cast<float>(atof(row[6]));
entry.hp_fac = static_cast<float>(atof(row[7]));
entry.mana_fac = static_cast<float>(atof(row[8]));
entry.end_fac = static_cast<float>(atof(row[9]));
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = content_db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_BASE_DATA_REPOSITORY_H
@@ -0,0 +1,407 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_BLOCKED_SPELLS_REPOSITORY_H
#define EQEMU_BASE_BLOCKED_SPELLS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseBlockedSpellsRepository {
public:
struct BlockedSpells {
int id;
int spellid;
int type;
int zoneid;
float x;
float y;
float z;
float x_diff;
float y_diff;
float z_diff;
std::string message;
std::string description;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"spellid",
"type",
"zoneid",
"x",
"y",
"z",
"x_diff",
"y_diff",
"z_diff",
"message",
"description",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string 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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static BlockedSpells NewEntity()
{
BlockedSpells entry{};
entry.id = 0;
entry.spellid = 0;
entry.type = 0;
entry.zoneid = 0;
entry.x = 0;
entry.y = 0;
entry.z = 0;
entry.x_diff = 0;
entry.y_diff = 0;
entry.z_diff = 0;
entry.message = "";
entry.description = "";
return entry;
}
static BlockedSpells GetBlockedSpellsEntry(
const std::vector<BlockedSpells> &blocked_spellss,
int blocked_spells_id
)
{
for (auto &blocked_spells : blocked_spellss) {
if (blocked_spells.id == blocked_spells_id) {
return blocked_spells;
}
}
return NewEntity();
}
static BlockedSpells FindOne(
int blocked_spells_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
blocked_spells_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
BlockedSpells entry{};
entry.id = atoi(row[0]);
entry.spellid = atoi(row[1]);
entry.type = atoi(row[2]);
entry.zoneid = atoi(row[3]);
entry.x = static_cast<float>(atof(row[4]));
entry.y = static_cast<float>(atof(row[5]));
entry.z = static_cast<float>(atof(row[6]));
entry.x_diff = static_cast<float>(atof(row[7]));
entry.y_diff = static_cast<float>(atof(row[8]));
entry.z_diff = static_cast<float>(atof(row[9]));
entry.message = row[10] ? row[10] : "";
entry.description = row[11] ? row[11] : "";
return entry;
}
return NewEntity();
}
static int DeleteOne(
int blocked_spells_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
blocked_spells_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
BlockedSpells blocked_spells_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[1] + " = " + std::to_string(blocked_spells_entry.spellid));
update_values.push_back(columns[2] + " = " + std::to_string(blocked_spells_entry.type));
update_values.push_back(columns[3] + " = " + std::to_string(blocked_spells_entry.zoneid));
update_values.push_back(columns[4] + " = " + std::to_string(blocked_spells_entry.x));
update_values.push_back(columns[5] + " = " + std::to_string(blocked_spells_entry.y));
update_values.push_back(columns[6] + " = " + std::to_string(blocked_spells_entry.z));
update_values.push_back(columns[7] + " = " + std::to_string(blocked_spells_entry.x_diff));
update_values.push_back(columns[8] + " = " + std::to_string(blocked_spells_entry.y_diff));
update_values.push_back(columns[9] + " = " + std::to_string(blocked_spells_entry.z_diff));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
blocked_spells_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static BlockedSpells InsertOne(
BlockedSpells blocked_spells_entry
)
{
std::vector<std::string> insert_values;
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));
insert_values.push_back(std::to_string(blocked_spells_entry.x));
insert_values.push_back(std::to_string(blocked_spells_entry.y));
insert_values.push_back(std::to_string(blocked_spells_entry.z));
insert_values.push_back(std::to_string(blocked_spells_entry.x_diff));
insert_values.push_back(std::to_string(blocked_spells_entry.y_diff));
insert_values.push_back(std::to_string(blocked_spells_entry.z_diff));
insert_values.push_back("'" + EscapeString(blocked_spells_entry.message) + "'");
insert_values.push_back("'" + EscapeString(blocked_spells_entry.description) + "'");
auto results = content_db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
blocked_spells_entry.id = results.LastInsertedID();
return blocked_spells_entry;
}
blocked_spells_entry = NewEntity();
return blocked_spells_entry;
}
static int InsertMany(
std::vector<BlockedSpells> blocked_spells_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &blocked_spells_entry: blocked_spells_entries) {
std::vector<std::string> insert_values;
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));
insert_values.push_back(std::to_string(blocked_spells_entry.x));
insert_values.push_back(std::to_string(blocked_spells_entry.y));
insert_values.push_back(std::to_string(blocked_spells_entry.z));
insert_values.push_back(std::to_string(blocked_spells_entry.x_diff));
insert_values.push_back(std::to_string(blocked_spells_entry.y_diff));
insert_values.push_back(std::to_string(blocked_spells_entry.z_diff));
insert_values.push_back("'" + EscapeString(blocked_spells_entry.message) + "'");
insert_values.push_back("'" + EscapeString(blocked_spells_entry.description) + "'");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<BlockedSpells> All()
{
std::vector<BlockedSpells> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
BlockedSpells entry{};
entry.id = atoi(row[0]);
entry.spellid = atoi(row[1]);
entry.type = atoi(row[2]);
entry.zoneid = atoi(row[3]);
entry.x = static_cast<float>(atof(row[4]));
entry.y = static_cast<float>(atof(row[5]));
entry.z = static_cast<float>(atof(row[6]));
entry.x_diff = static_cast<float>(atof(row[7]));
entry.y_diff = static_cast<float>(atof(row[8]));
entry.z_diff = static_cast<float>(atof(row[9]));
entry.message = row[10] ? row[10] : "";
entry.description = row[11] ? row[11] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<BlockedSpells> GetWhere(std::string where_filter)
{
std::vector<BlockedSpells> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
BlockedSpells entry{};
entry.id = atoi(row[0]);
entry.spellid = atoi(row[1]);
entry.type = atoi(row[2]);
entry.zoneid = atoi(row[3]);
entry.x = static_cast<float>(atof(row[4]));
entry.y = static_cast<float>(atof(row[5]));
entry.z = static_cast<float>(atof(row[6]));
entry.x_diff = static_cast<float>(atof(row[7]));
entry.y_diff = static_cast<float>(atof(row[8]));
entry.z_diff = static_cast<float>(atof(row[9]));
entry.message = row[10] ? row[10] : "";
entry.description = row[11] ? row[11] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = content_db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_BLOCKED_SPELLS_REPOSITORY_H
@@ -0,0 +1,587 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_BUG_REPORTS_REPOSITORY_H
#define EQEMU_BASE_BUG_REPORTS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseBugReportsRepository {
public:
struct BugReports {
int id;
std::string zone;
int client_version_id;
std::string client_version_name;
int account_id;
int character_id;
std::string character_name;
int reporter_spoof;
int category_id;
std::string category_name;
std::string reporter_name;
std::string ui_path;
float pos_x;
float pos_y;
float pos_z;
int heading;
int time_played;
int target_id;
std::string target_name;
int optional_info_mask;
int _can_duplicate;
int _crash_bug;
int _target_info;
int _character_flags;
int _unknown_value;
std::string bug_report;
std::string system_info;
std::string report_datetime;
int bug_status;
std::string last_review;
std::string last_reviewer;
std::string reviewer_notes;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"zone",
"client_version_id",
"client_version_name",
"account_id",
"character_id",
"character_name",
"reporter_spoof",
"category_id",
"category_name",
"reporter_name",
"ui_path",
"pos_x",
"pos_y",
"pos_z",
"heading",
"time_played",
"target_id",
"target_name",
"optional_info_mask",
"_can_duplicate",
"_crash_bug",
"_target_info",
"_character_flags",
"_unknown_value",
"bug_report",
"system_info",
"report_datetime",
"bug_status",
"last_review",
"last_reviewer",
"reviewer_notes",
};
}
static std::string ColumnsRaw()
{
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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static BugReports NewEntity()
{
BugReports entry{};
entry.id = 0;
entry.zone = "Unknown";
entry.client_version_id = 0;
entry.client_version_name = "Unknown";
entry.account_id = 0;
entry.character_id = 0;
entry.character_name = "Unknown";
entry.reporter_spoof = 1;
entry.category_id = 0;
entry.category_name = "Other";
entry.reporter_name = "Unknown";
entry.ui_path = "Unknown";
entry.pos_x = 0;
entry.pos_y = 0;
entry.pos_z = 0;
entry.heading = 0;
entry.time_played = 0;
entry.target_id = 0;
entry.target_name = "Unknown";
entry.optional_info_mask = 0;
entry._can_duplicate = 0;
entry._crash_bug = 0;
entry._target_info = 0;
entry._character_flags = 0;
entry._unknown_value = 0;
entry.bug_report = "";
entry.system_info = "";
entry.report_datetime = current_timestamp();
entry.bug_status = 0;
entry.last_review = current_timestamp();
entry.last_reviewer = "None";
entry.reviewer_notes = "";
return entry;
}
static BugReports GetBugReportsEntry(
const std::vector<BugReports> &bug_reportss,
int bug_reports_id
)
{
for (auto &bug_reports : bug_reportss) {
if (bug_reports.id == bug_reports_id) {
return bug_reports;
}
}
return NewEntity();
}
static BugReports FindOne(
int bug_reports_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
bug_reports_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
BugReports entry{};
entry.id = atoi(row[0]);
entry.zone = row[1] ? row[1] : "";
entry.client_version_id = atoi(row[2]);
entry.client_version_name = row[3] ? row[3] : "";
entry.account_id = atoi(row[4]);
entry.character_id = atoi(row[5]);
entry.character_name = row[6] ? row[6] : "";
entry.reporter_spoof = atoi(row[7]);
entry.category_id = atoi(row[8]);
entry.category_name = row[9] ? row[9] : "";
entry.reporter_name = row[10] ? row[10] : "";
entry.ui_path = row[11] ? row[11] : "";
entry.pos_x = static_cast<float>(atof(row[12]));
entry.pos_y = static_cast<float>(atof(row[13]));
entry.pos_z = static_cast<float>(atof(row[14]));
entry.heading = atoi(row[15]);
entry.time_played = atoi(row[16]);
entry.target_id = atoi(row[17]);
entry.target_name = row[18] ? row[18] : "";
entry.optional_info_mask = atoi(row[19]);
entry._can_duplicate = atoi(row[20]);
entry._crash_bug = atoi(row[21]);
entry._target_info = atoi(row[22]);
entry._character_flags = atoi(row[23]);
entry._unknown_value = atoi(row[24]);
entry.bug_report = row[25] ? row[25] : "";
entry.system_info = row[26] ? row[26] : "";
entry.report_datetime = row[27] ? row[27] : "";
entry.bug_status = atoi(row[28]);
entry.last_review = row[29] ? row[29] : "";
entry.last_reviewer = row[30] ? row[30] : "";
entry.reviewer_notes = row[31] ? row[31] : "";
return entry;
}
return NewEntity();
}
static int DeleteOne(
int bug_reports_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
bug_reports_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
BugReports bug_reports_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[1] + " = '" + EscapeString(bug_reports_entry.zone) + "'");
update_values.push_back(columns[2] + " = " + std::to_string(bug_reports_entry.client_version_id));
update_values.push_back(columns[3] + " = '" + EscapeString(bug_reports_entry.client_version_name) + "'");
update_values.push_back(columns[4] + " = " + std::to_string(bug_reports_entry.account_id));
update_values.push_back(columns[5] + " = " + std::to_string(bug_reports_entry.character_id));
update_values.push_back(columns[6] + " = '" + EscapeString(bug_reports_entry.character_name) + "'");
update_values.push_back(columns[7] + " = " + std::to_string(bug_reports_entry.reporter_spoof));
update_values.push_back(columns[8] + " = " + std::to_string(bug_reports_entry.category_id));
update_values.push_back(columns[9] + " = '" + EscapeString(bug_reports_entry.category_name) + "'");
update_values.push_back(columns[10] + " = '" + EscapeString(bug_reports_entry.reporter_name) + "'");
update_values.push_back(columns[11] + " = '" + EscapeString(bug_reports_entry.ui_path) + "'");
update_values.push_back(columns[12] + " = " + std::to_string(bug_reports_entry.pos_x));
update_values.push_back(columns[13] + " = " + std::to_string(bug_reports_entry.pos_y));
update_values.push_back(columns[14] + " = " + std::to_string(bug_reports_entry.pos_z));
update_values.push_back(columns[15] + " = " + std::to_string(bug_reports_entry.heading));
update_values.push_back(columns[16] + " = " + std::to_string(bug_reports_entry.time_played));
update_values.push_back(columns[17] + " = " + std::to_string(bug_reports_entry.target_id));
update_values.push_back(columns[18] + " = '" + EscapeString(bug_reports_entry.target_name) + "'");
update_values.push_back(columns[19] + " = " + std::to_string(bug_reports_entry.optional_info_mask));
update_values.push_back(columns[20] + " = " + std::to_string(bug_reports_entry._can_duplicate));
update_values.push_back(columns[21] + " = " + std::to_string(bug_reports_entry._crash_bug));
update_values.push_back(columns[22] + " = " + std::to_string(bug_reports_entry._target_info));
update_values.push_back(columns[23] + " = " + std::to_string(bug_reports_entry._character_flags));
update_values.push_back(columns[24] + " = " + std::to_string(bug_reports_entry._unknown_value));
update_values.push_back(columns[25] + " = '" + EscapeString(bug_reports_entry.bug_report) + "'");
update_values.push_back(columns[26] + " = '" + EscapeString(bug_reports_entry.system_info) + "'");
update_values.push_back(columns[27] + " = '" + EscapeString(bug_reports_entry.report_datetime) + "'");
update_values.push_back(columns[28] + " = " + std::to_string(bug_reports_entry.bug_status));
update_values.push_back(columns[29] + " = '" + EscapeString(bug_reports_entry.last_review) + "'");
update_values.push_back(columns[30] + " = '" + EscapeString(bug_reports_entry.last_reviewer) + "'");
update_values.push_back(columns[31] + " = '" + EscapeString(bug_reports_entry.reviewer_notes) + "'");
auto results = database.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
bug_reports_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static BugReports InsertOne(
BugReports bug_reports_entry
)
{
std::vector<std::string> insert_values;
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) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.account_id));
insert_values.push_back(std::to_string(bug_reports_entry.character_id));
insert_values.push_back("'" + EscapeString(bug_reports_entry.character_name) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.reporter_spoof));
insert_values.push_back(std::to_string(bug_reports_entry.category_id));
insert_values.push_back("'" + EscapeString(bug_reports_entry.category_name) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.reporter_name) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.ui_path) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.pos_x));
insert_values.push_back(std::to_string(bug_reports_entry.pos_y));
insert_values.push_back(std::to_string(bug_reports_entry.pos_z));
insert_values.push_back(std::to_string(bug_reports_entry.heading));
insert_values.push_back(std::to_string(bug_reports_entry.time_played));
insert_values.push_back(std::to_string(bug_reports_entry.target_id));
insert_values.push_back("'" + EscapeString(bug_reports_entry.target_name) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.optional_info_mask));
insert_values.push_back(std::to_string(bug_reports_entry._can_duplicate));
insert_values.push_back(std::to_string(bug_reports_entry._crash_bug));
insert_values.push_back(std::to_string(bug_reports_entry._target_info));
insert_values.push_back(std::to_string(bug_reports_entry._character_flags));
insert_values.push_back(std::to_string(bug_reports_entry._unknown_value));
insert_values.push_back("'" + EscapeString(bug_reports_entry.bug_report) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.system_info) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.report_datetime) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.bug_status));
insert_values.push_back("'" + EscapeString(bug_reports_entry.last_review) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.last_reviewer) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.reviewer_notes) + "'");
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
bug_reports_entry.id = results.LastInsertedID();
return bug_reports_entry;
}
bug_reports_entry = NewEntity();
return bug_reports_entry;
}
static int InsertMany(
std::vector<BugReports> bug_reports_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &bug_reports_entry: bug_reports_entries) {
std::vector<std::string> insert_values;
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) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.account_id));
insert_values.push_back(std::to_string(bug_reports_entry.character_id));
insert_values.push_back("'" + EscapeString(bug_reports_entry.character_name) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.reporter_spoof));
insert_values.push_back(std::to_string(bug_reports_entry.category_id));
insert_values.push_back("'" + EscapeString(bug_reports_entry.category_name) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.reporter_name) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.ui_path) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.pos_x));
insert_values.push_back(std::to_string(bug_reports_entry.pos_y));
insert_values.push_back(std::to_string(bug_reports_entry.pos_z));
insert_values.push_back(std::to_string(bug_reports_entry.heading));
insert_values.push_back(std::to_string(bug_reports_entry.time_played));
insert_values.push_back(std::to_string(bug_reports_entry.target_id));
insert_values.push_back("'" + EscapeString(bug_reports_entry.target_name) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.optional_info_mask));
insert_values.push_back(std::to_string(bug_reports_entry._can_duplicate));
insert_values.push_back(std::to_string(bug_reports_entry._crash_bug));
insert_values.push_back(std::to_string(bug_reports_entry._target_info));
insert_values.push_back(std::to_string(bug_reports_entry._character_flags));
insert_values.push_back(std::to_string(bug_reports_entry._unknown_value));
insert_values.push_back("'" + EscapeString(bug_reports_entry.bug_report) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.system_info) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.report_datetime) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.bug_status));
insert_values.push_back("'" + EscapeString(bug_reports_entry.last_review) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.last_reviewer) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.reviewer_notes) + "'");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<BugReports> All()
{
std::vector<BugReports> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
BugReports entry{};
entry.id = atoi(row[0]);
entry.zone = row[1] ? row[1] : "";
entry.client_version_id = atoi(row[2]);
entry.client_version_name = row[3] ? row[3] : "";
entry.account_id = atoi(row[4]);
entry.character_id = atoi(row[5]);
entry.character_name = row[6] ? row[6] : "";
entry.reporter_spoof = atoi(row[7]);
entry.category_id = atoi(row[8]);
entry.category_name = row[9] ? row[9] : "";
entry.reporter_name = row[10] ? row[10] : "";
entry.ui_path = row[11] ? row[11] : "";
entry.pos_x = static_cast<float>(atof(row[12]));
entry.pos_y = static_cast<float>(atof(row[13]));
entry.pos_z = static_cast<float>(atof(row[14]));
entry.heading = atoi(row[15]);
entry.time_played = atoi(row[16]);
entry.target_id = atoi(row[17]);
entry.target_name = row[18] ? row[18] : "";
entry.optional_info_mask = atoi(row[19]);
entry._can_duplicate = atoi(row[20]);
entry._crash_bug = atoi(row[21]);
entry._target_info = atoi(row[22]);
entry._character_flags = atoi(row[23]);
entry._unknown_value = atoi(row[24]);
entry.bug_report = row[25] ? row[25] : "";
entry.system_info = row[26] ? row[26] : "";
entry.report_datetime = row[27] ? row[27] : "";
entry.bug_status = atoi(row[28]);
entry.last_review = row[29] ? row[29] : "";
entry.last_reviewer = row[30] ? row[30] : "";
entry.reviewer_notes = row[31] ? row[31] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<BugReports> GetWhere(std::string where_filter)
{
std::vector<BugReports> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
BugReports entry{};
entry.id = atoi(row[0]);
entry.zone = row[1] ? row[1] : "";
entry.client_version_id = atoi(row[2]);
entry.client_version_name = row[3] ? row[3] : "";
entry.account_id = atoi(row[4]);
entry.character_id = atoi(row[5]);
entry.character_name = row[6] ? row[6] : "";
entry.reporter_spoof = atoi(row[7]);
entry.category_id = atoi(row[8]);
entry.category_name = row[9] ? row[9] : "";
entry.reporter_name = row[10] ? row[10] : "";
entry.ui_path = row[11] ? row[11] : "";
entry.pos_x = static_cast<float>(atof(row[12]));
entry.pos_y = static_cast<float>(atof(row[13]));
entry.pos_z = static_cast<float>(atof(row[14]));
entry.heading = atoi(row[15]);
entry.time_played = atoi(row[16]);
entry.target_id = atoi(row[17]);
entry.target_name = row[18] ? row[18] : "";
entry.optional_info_mask = atoi(row[19]);
entry._can_duplicate = atoi(row[20]);
entry._crash_bug = atoi(row[21]);
entry._target_info = atoi(row[22]);
entry._character_flags = atoi(row[23]);
entry._unknown_value = atoi(row[24]);
entry.bug_report = row[25] ? row[25] : "";
entry.system_info = row[26] ? row[26] : "";
entry.report_datetime = row[27] ? row[27] : "";
entry.bug_status = atoi(row[28]);
entry.last_review = row[29] ? row[29] : "";
entry.last_reviewer = row[30] ? row[30] : "";
entry.reviewer_notes = row[31] ? row[31] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = database.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_BUG_REPORTS_REPOSITORY_H
@@ -0,0 +1,416 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_BUGS_REPOSITORY_H
#define EQEMU_BASE_BUGS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseBugsRepository {
public:
struct Bugs {
int id;
std::string zone;
std::string name;
std::string ui;
float x;
float y;
float z;
std::string type;
int flag;
std::string target;
std::string bug;
std::string date;
int status;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"zone",
"name",
"ui",
"x",
"y",
"z",
"type",
"flag",
"target",
"bug",
"date",
"status",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string 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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static Bugs NewEntity()
{
Bugs entry{};
entry.id = 0;
entry.zone = "";
entry.name = "";
entry.ui = "";
entry.x = 0;
entry.y = 0;
entry.z = 0;
entry.type = "";
entry.flag = 0;
entry.target = "";
entry.bug = "";
entry.date = 0;
entry.status = 0;
return entry;
}
static Bugs GetBugsEntry(
const std::vector<Bugs> &bugss,
int bugs_id
)
{
for (auto &bugs : bugss) {
if (bugs.id == bugs_id) {
return bugs;
}
}
return NewEntity();
}
static Bugs FindOne(
int bugs_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
bugs_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
Bugs entry{};
entry.id = atoi(row[0]);
entry.zone = row[1] ? row[1] : "";
entry.name = row[2] ? row[2] : "";
entry.ui = row[3] ? row[3] : "";
entry.x = static_cast<float>(atof(row[4]));
entry.y = static_cast<float>(atof(row[5]));
entry.z = static_cast<float>(atof(row[6]));
entry.type = row[7] ? row[7] : "";
entry.flag = atoi(row[8]);
entry.target = row[9] ? row[9] : "";
entry.bug = row[10] ? row[10] : "";
entry.date = row[11] ? row[11] : "";
entry.status = atoi(row[12]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int bugs_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
bugs_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Bugs bugs_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[1] + " = '" + EscapeString(bugs_entry.zone) + "'");
update_values.push_back(columns[2] + " = '" + EscapeString(bugs_entry.name) + "'");
update_values.push_back(columns[3] + " = '" + EscapeString(bugs_entry.ui) + "'");
update_values.push_back(columns[4] + " = " + std::to_string(bugs_entry.x));
update_values.push_back(columns[5] + " = " + std::to_string(bugs_entry.y));
update_values.push_back(columns[6] + " = " + std::to_string(bugs_entry.z));
update_values.push_back(columns[7] + " = '" + EscapeString(bugs_entry.type) + "'");
update_values.push_back(columns[8] + " = " + std::to_string(bugs_entry.flag));
update_values.push_back(columns[9] + " = '" + EscapeString(bugs_entry.target) + "'");
update_values.push_back(columns[10] + " = '" + EscapeString(bugs_entry.bug) + "'");
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
bugs_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static Bugs InsertOne(
Bugs bugs_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back("'" + EscapeString(bugs_entry.zone) + "'");
insert_values.push_back("'" + EscapeString(bugs_entry.name) + "'");
insert_values.push_back("'" + EscapeString(bugs_entry.ui) + "'");
insert_values.push_back(std::to_string(bugs_entry.x));
insert_values.push_back(std::to_string(bugs_entry.y));
insert_values.push_back(std::to_string(bugs_entry.z));
insert_values.push_back("'" + EscapeString(bugs_entry.type) + "'");
insert_values.push_back(std::to_string(bugs_entry.flag));
insert_values.push_back("'" + EscapeString(bugs_entry.target) + "'");
insert_values.push_back("'" + EscapeString(bugs_entry.bug) + "'");
insert_values.push_back("'" + EscapeString(bugs_entry.date) + "'");
insert_values.push_back(std::to_string(bugs_entry.status));
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
bugs_entry.id = results.LastInsertedID();
return bugs_entry;
}
bugs_entry = NewEntity();
return bugs_entry;
}
static int InsertMany(
std::vector<Bugs> bugs_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &bugs_entry: bugs_entries) {
std::vector<std::string> insert_values;
insert_values.push_back("'" + EscapeString(bugs_entry.zone) + "'");
insert_values.push_back("'" + EscapeString(bugs_entry.name) + "'");
insert_values.push_back("'" + EscapeString(bugs_entry.ui) + "'");
insert_values.push_back(std::to_string(bugs_entry.x));
insert_values.push_back(std::to_string(bugs_entry.y));
insert_values.push_back(std::to_string(bugs_entry.z));
insert_values.push_back("'" + EscapeString(bugs_entry.type) + "'");
insert_values.push_back(std::to_string(bugs_entry.flag));
insert_values.push_back("'" + EscapeString(bugs_entry.target) + "'");
insert_values.push_back("'" + EscapeString(bugs_entry.bug) + "'");
insert_values.push_back("'" + EscapeString(bugs_entry.date) + "'");
insert_values.push_back(std::to_string(bugs_entry.status));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<Bugs> All()
{
std::vector<Bugs> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
Bugs entry{};
entry.id = atoi(row[0]);
entry.zone = row[1] ? row[1] : "";
entry.name = row[2] ? row[2] : "";
entry.ui = row[3] ? row[3] : "";
entry.x = static_cast<float>(atof(row[4]));
entry.y = static_cast<float>(atof(row[5]));
entry.z = static_cast<float>(atof(row[6]));
entry.type = row[7] ? row[7] : "";
entry.flag = atoi(row[8]);
entry.target = row[9] ? row[9] : "";
entry.bug = row[10] ? row[10] : "";
entry.date = row[11] ? row[11] : "";
entry.status = atoi(row[12]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<Bugs> GetWhere(std::string where_filter)
{
std::vector<Bugs> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
Bugs entry{};
entry.id = atoi(row[0]);
entry.zone = row[1] ? row[1] : "";
entry.name = row[2] ? row[2] : "";
entry.ui = row[3] ? row[3] : "";
entry.x = static_cast<float>(atof(row[4]));
entry.y = static_cast<float>(atof(row[5]));
entry.z = static_cast<float>(atof(row[6]));
entry.type = row[7] ? row[7] : "";
entry.flag = atoi(row[8]);
entry.target = row[9] ? row[9] : "";
entry.bug = row[10] ? row[10] : "";
entry.date = row[11] ? row[11] : "";
entry.status = atoi(row[12]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = database.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_BUGS_REPOSITORY_H
@@ -0,0 +1,356 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_BUYER_REPOSITORY_H
#define EQEMU_BASE_BUYER_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseBuyerRepository {
public:
struct Buyer {
int charid;
int buyslot;
int itemid;
std::string itemname;
int quantity;
int price;
};
static std::string PrimaryKey()
{
return std::string("charid");
}
static std::vector<std::string> Columns()
{
return {
"charid",
"buyslot",
"itemid",
"itemname",
"quantity",
"price",
};
}
static std::string ColumnsRaw()
{
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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static Buyer NewEntity()
{
Buyer entry{};
entry.charid = 0;
entry.buyslot = 0;
entry.itemid = 0;
entry.itemname = "";
entry.quantity = 0;
entry.price = 0;
return entry;
}
static Buyer GetBuyerEntry(
const std::vector<Buyer> &buyers,
int buyer_id
)
{
for (auto &buyer : buyers) {
if (buyer.charid == buyer_id) {
return buyer;
}
}
return NewEntity();
}
static Buyer FindOne(
int buyer_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
buyer_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
Buyer entry{};
entry.charid = atoi(row[0]);
entry.buyslot = atoi(row[1]);
entry.itemid = atoi(row[2]);
entry.itemname = row[3] ? row[3] : "";
entry.quantity = atoi(row[4]);
entry.price = atoi(row[5]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int buyer_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
buyer_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Buyer buyer_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(buyer_entry.charid));
update_values.push_back(columns[1] + " = " + std::to_string(buyer_entry.buyslot));
update_values.push_back(columns[2] + " = " + std::to_string(buyer_entry.itemid));
update_values.push_back(columns[3] + " = '" + EscapeString(buyer_entry.itemname) + "'");
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
buyer_entry.charid
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static Buyer InsertOne(
Buyer buyer_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(buyer_entry.charid));
insert_values.push_back(std::to_string(buyer_entry.buyslot));
insert_values.push_back(std::to_string(buyer_entry.itemid));
insert_values.push_back("'" + EscapeString(buyer_entry.itemname) + "'");
insert_values.push_back(std::to_string(buyer_entry.quantity));
insert_values.push_back(std::to_string(buyer_entry.price));
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
buyer_entry.charid = results.LastInsertedID();
return buyer_entry;
}
buyer_entry = NewEntity();
return buyer_entry;
}
static int InsertMany(
std::vector<Buyer> buyer_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &buyer_entry: buyer_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(buyer_entry.charid));
insert_values.push_back(std::to_string(buyer_entry.buyslot));
insert_values.push_back(std::to_string(buyer_entry.itemid));
insert_values.push_back("'" + EscapeString(buyer_entry.itemname) + "'");
insert_values.push_back(std::to_string(buyer_entry.quantity));
insert_values.push_back(std::to_string(buyer_entry.price));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<Buyer> All()
{
std::vector<Buyer> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
Buyer entry{};
entry.charid = atoi(row[0]);
entry.buyslot = atoi(row[1]);
entry.itemid = atoi(row[2]);
entry.itemname = row[3] ? row[3] : "";
entry.quantity = atoi(row[4]);
entry.price = atoi(row[5]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<Buyer> GetWhere(std::string where_filter)
{
std::vector<Buyer> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
Buyer entry{};
entry.charid = atoi(row[0]);
entry.buyslot = atoi(row[1]);
entry.itemid = atoi(row[2]);
entry.itemname = row[3] ? row[3] : "";
entry.quantity = atoi(row[4]);
entry.price = atoi(row[5]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = database.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_BUYER_REPOSITORY_H
@@ -0,0 +1,356 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_CHAR_CREATE_COMBINATIONS_REPOSITORY_H
#define EQEMU_BASE_CHAR_CREATE_COMBINATIONS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharCreateCombinationsRepository {
public:
struct CharCreateCombinations {
int allocation_id;
int race;
int class;
int deity;
int start_zone;
int expansions_req;
};
static std::string PrimaryKey()
{
return std::string("race");
}
static std::vector<std::string> Columns()
{
return {
"allocation_id",
"race",
"class",
"deity",
"start_zone",
"expansions_req",
};
}
static std::string ColumnsRaw()
{
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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static CharCreateCombinations NewEntity()
{
CharCreateCombinations entry{};
entry.allocation_id = 0;
entry.race = 0;
entry.class = 0;
entry.deity = 0;
entry.start_zone = 0;
entry.expansions_req = 0;
return entry;
}
static CharCreateCombinations GetCharCreateCombinationsEntry(
const std::vector<CharCreateCombinations> &char_create_combinationss,
int char_create_combinations_id
)
{
for (auto &char_create_combinations : char_create_combinationss) {
if (char_create_combinations.race == char_create_combinations_id) {
return char_create_combinations;
}
}
return NewEntity();
}
static CharCreateCombinations FindOne(
int char_create_combinations_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
char_create_combinations_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharCreateCombinations entry{};
entry.allocation_id = atoi(row[0]);
entry.race = atoi(row[1]);
entry.class = atoi(row[2]);
entry.deity = atoi(row[3]);
entry.start_zone = atoi(row[4]);
entry.expansions_req = atoi(row[5]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int char_create_combinations_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
char_create_combinations_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
CharCreateCombinations char_create_combinations_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(char_create_combinations_entry.allocation_id));
update_values.push_back(columns[1] + " = " + std::to_string(char_create_combinations_entry.race));
update_values.push_back(columns[2] + " = " + std::to_string(char_create_combinations_entry.class));
update_values.push_back(columns[3] + " = " + std::to_string(char_create_combinations_entry.deity));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
char_create_combinations_entry.race
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharCreateCombinations InsertOne(
CharCreateCombinations char_create_combinations_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(char_create_combinations_entry.allocation_id));
insert_values.push_back(std::to_string(char_create_combinations_entry.race));
insert_values.push_back(std::to_string(char_create_combinations_entry.class));
insert_values.push_back(std::to_string(char_create_combinations_entry.deity));
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
char_create_combinations_entry.race = results.LastInsertedID();
return char_create_combinations_entry;
}
char_create_combinations_entry = NewEntity();
return char_create_combinations_entry;
}
static int InsertMany(
std::vector<CharCreateCombinations> char_create_combinations_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &char_create_combinations_entry: char_create_combinations_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(char_create_combinations_entry.allocation_id));
insert_values.push_back(std::to_string(char_create_combinations_entry.race));
insert_values.push_back(std::to_string(char_create_combinations_entry.class));
insert_values.push_back(std::to_string(char_create_combinations_entry.deity));
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));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharCreateCombinations> All()
{
std::vector<CharCreateCombinations> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharCreateCombinations entry{};
entry.allocation_id = atoi(row[0]);
entry.race = atoi(row[1]);
entry.class = atoi(row[2]);
entry.deity = atoi(row[3]);
entry.start_zone = atoi(row[4]);
entry.expansions_req = atoi(row[5]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharCreateCombinations> GetWhere(std::string where_filter)
{
std::vector<CharCreateCombinations> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharCreateCombinations entry{};
entry.allocation_id = atoi(row[0]);
entry.race = atoi(row[1]);
entry.class = atoi(row[2]);
entry.deity = atoi(row[3]);
entry.start_zone = atoi(row[4]);
entry.expansions_req = atoi(row[5]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = content_db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_CHAR_CREATE_COMBINATIONS_REPOSITORY_H
@@ -0,0 +1,437 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_CHAR_CREATE_POINT_ALLOCATIONS_REPOSITORY_H
#define EQEMU_BASE_CHAR_CREATE_POINT_ALLOCATIONS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharCreatePointAllocationsRepository {
public:
struct CharCreatePointAllocations {
int id;
int base_str;
int base_sta;
int base_dex;
int base_agi;
int base_int;
int base_wis;
int base_cha;
int alloc_str;
int alloc_sta;
int alloc_dex;
int alloc_agi;
int alloc_int;
int alloc_wis;
int alloc_cha;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"base_str",
"base_sta",
"base_dex",
"base_agi",
"base_int",
"base_wis",
"base_cha",
"alloc_str",
"alloc_sta",
"alloc_dex",
"alloc_agi",
"alloc_int",
"alloc_wis",
"alloc_cha",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string 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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static CharCreatePointAllocations NewEntity()
{
CharCreatePointAllocations entry{};
entry.id = 0;
entry.base_str = 0;
entry.base_sta = 0;
entry.base_dex = 0;
entry.base_agi = 0;
entry.base_int = 0;
entry.base_wis = 0;
entry.base_cha = 0;
entry.alloc_str = 0;
entry.alloc_sta = 0;
entry.alloc_dex = 0;
entry.alloc_agi = 0;
entry.alloc_int = 0;
entry.alloc_wis = 0;
entry.alloc_cha = 0;
return entry;
}
static CharCreatePointAllocations GetCharCreatePointAllocationsEntry(
const std::vector<CharCreatePointAllocations> &char_create_point_allocationss,
int char_create_point_allocations_id
)
{
for (auto &char_create_point_allocations : char_create_point_allocationss) {
if (char_create_point_allocations.id == char_create_point_allocations_id) {
return char_create_point_allocations;
}
}
return NewEntity();
}
static CharCreatePointAllocations FindOne(
int char_create_point_allocations_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
char_create_point_allocations_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharCreatePointAllocations entry{};
entry.id = atoi(row[0]);
entry.base_str = atoi(row[1]);
entry.base_sta = atoi(row[2]);
entry.base_dex = atoi(row[3]);
entry.base_agi = atoi(row[4]);
entry.base_int = atoi(row[5]);
entry.base_wis = atoi(row[6]);
entry.base_cha = atoi(row[7]);
entry.alloc_str = atoi(row[8]);
entry.alloc_sta = atoi(row[9]);
entry.alloc_dex = atoi(row[10]);
entry.alloc_agi = atoi(row[11]);
entry.alloc_int = atoi(row[12]);
entry.alloc_wis = atoi(row[13]);
entry.alloc_cha = atoi(row[14]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int char_create_point_allocations_id
)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
char_create_point_allocations_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
CharCreatePointAllocations char_create_point_allocations_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(char_create_point_allocations_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(char_create_point_allocations_entry.base_str));
update_values.push_back(columns[2] + " = " + std::to_string(char_create_point_allocations_entry.base_sta));
update_values.push_back(columns[3] + " = " + std::to_string(char_create_point_allocations_entry.base_dex));
update_values.push_back(columns[4] + " = " + std::to_string(char_create_point_allocations_entry.base_agi));
update_values.push_back(columns[5] + " = " + std::to_string(char_create_point_allocations_entry.base_int));
update_values.push_back(columns[6] + " = " + std::to_string(char_create_point_allocations_entry.base_wis));
update_values.push_back(columns[7] + " = " + std::to_string(char_create_point_allocations_entry.base_cha));
update_values.push_back(columns[8] + " = " + std::to_string(char_create_point_allocations_entry.alloc_str));
update_values.push_back(columns[9] + " = " + std::to_string(char_create_point_allocations_entry.alloc_sta));
update_values.push_back(columns[10] + " = " + std::to_string(char_create_point_allocations_entry.alloc_dex));
update_values.push_back(columns[11] + " = " + std::to_string(char_create_point_allocations_entry.alloc_agi));
update_values.push_back(columns[12] + " = " + std::to_string(char_create_point_allocations_entry.alloc_int));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
char_create_point_allocations_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharCreatePointAllocations InsertOne(
CharCreatePointAllocations char_create_point_allocations_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(char_create_point_allocations_entry.id));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_str));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_sta));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_dex));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_agi));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_int));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_wis));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_cha));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_str));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_sta));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_dex));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_agi));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_int));
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
char_create_point_allocations_entry.id = results.LastInsertedID();
return char_create_point_allocations_entry;
}
char_create_point_allocations_entry = NewEntity();
return char_create_point_allocations_entry;
}
static int InsertMany(
std::vector<CharCreatePointAllocations> char_create_point_allocations_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &char_create_point_allocations_entry: char_create_point_allocations_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(char_create_point_allocations_entry.id));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_str));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_sta));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_dex));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_agi));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_int));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_wis));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_cha));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_str));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_sta));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_dex));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_agi));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_int));
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));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = content_db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharCreatePointAllocations> All()
{
std::vector<CharCreatePointAllocations> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharCreatePointAllocations entry{};
entry.id = atoi(row[0]);
entry.base_str = atoi(row[1]);
entry.base_sta = atoi(row[2]);
entry.base_dex = atoi(row[3]);
entry.base_agi = atoi(row[4]);
entry.base_int = atoi(row[5]);
entry.base_wis = atoi(row[6]);
entry.base_cha = atoi(row[7]);
entry.alloc_str = atoi(row[8]);
entry.alloc_sta = atoi(row[9]);
entry.alloc_dex = atoi(row[10]);
entry.alloc_agi = atoi(row[11]);
entry.alloc_int = atoi(row[12]);
entry.alloc_wis = atoi(row[13]);
entry.alloc_cha = atoi(row[14]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharCreatePointAllocations> GetWhere(std::string where_filter)
{
std::vector<CharCreatePointAllocations> all_entries;
auto results = content_db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharCreatePointAllocations entry{};
entry.id = atoi(row[0]);
entry.base_str = atoi(row[1]);
entry.base_sta = atoi(row[2]);
entry.base_dex = atoi(row[3]);
entry.base_agi = atoi(row[4]);
entry.base_int = atoi(row[5]);
entry.base_wis = atoi(row[6]);
entry.base_cha = atoi(row[7]);
entry.alloc_str = atoi(row[8]);
entry.alloc_sta = atoi(row[9]);
entry.alloc_dex = atoi(row[10]);
entry.alloc_agi = atoi(row[11]);
entry.alloc_int = atoi(row[12]);
entry.alloc_wis = atoi(row[13]);
entry.alloc_cha = atoi(row[14]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = content_db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = content_db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_CHAR_CREATE_POINT_ALLOCATIONS_REPOSITORY_H
@@ -0,0 +1,329 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_CHAR_RECIPE_LIST_REPOSITORY_H
#define EQEMU_BASE_CHAR_RECIPE_LIST_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharRecipeListRepository {
public:
struct CharRecipeList {
int char_id;
int recipe_id;
int madecount;
};
static std::string PrimaryKey()
{
return std::string("char_id");
}
static std::vector<std::string> Columns()
{
return {
"char_id",
"recipe_id",
"madecount",
};
}
static std::string ColumnsRaw()
{
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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static CharRecipeList NewEntity()
{
CharRecipeList entry{};
entry.char_id = 0;
entry.recipe_id = 0;
entry.madecount = 0;
return entry;
}
static CharRecipeList GetCharRecipeListEntry(
const std::vector<CharRecipeList> &char_recipe_lists,
int char_recipe_list_id
)
{
for (auto &char_recipe_list : char_recipe_lists) {
if (char_recipe_list.char_id == char_recipe_list_id) {
return char_recipe_list;
}
}
return NewEntity();
}
static CharRecipeList FindOne(
int char_recipe_list_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
char_recipe_list_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharRecipeList entry{};
entry.char_id = atoi(row[0]);
entry.recipe_id = atoi(row[1]);
entry.madecount = atoi(row[2]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int char_recipe_list_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
char_recipe_list_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
CharRecipeList char_recipe_list_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(char_recipe_list_entry.char_id));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
char_recipe_list_entry.char_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharRecipeList InsertOne(
CharRecipeList char_recipe_list_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(char_recipe_list_entry.char_id));
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
char_recipe_list_entry.char_id = results.LastInsertedID();
return char_recipe_list_entry;
}
char_recipe_list_entry = NewEntity();
return char_recipe_list_entry;
}
static int InsertMany(
std::vector<CharRecipeList> char_recipe_list_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &char_recipe_list_entry: char_recipe_list_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(char_recipe_list_entry.char_id));
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));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharRecipeList> All()
{
std::vector<CharRecipeList> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharRecipeList entry{};
entry.char_id = atoi(row[0]);
entry.recipe_id = atoi(row[1]);
entry.madecount = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharRecipeList> GetWhere(std::string where_filter)
{
std::vector<CharRecipeList> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharRecipeList entry{};
entry.char_id = atoi(row[0]);
entry.recipe_id = atoi(row[1]);
entry.madecount = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = database.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_CHAR_RECIPE_LIST_REPOSITORY_H
@@ -0,0 +1,347 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_CHARACTER_ACTIVITIES_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_ACTIVITIES_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterActivitiesRepository {
public:
struct CharacterActivities {
int charid;
int taskid;
int activityid;
int donecount;
int completed;
};
static std::string PrimaryKey()
{
return std::string("charid");
}
static std::vector<std::string> Columns()
{
return {
"charid",
"taskid",
"activityid",
"donecount",
"completed",
};
}
static std::string ColumnsRaw()
{
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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static CharacterActivities NewEntity()
{
CharacterActivities entry{};
entry.charid = 0;
entry.taskid = 0;
entry.activityid = 0;
entry.donecount = 0;
entry.completed = 0;
return entry;
}
static CharacterActivities GetCharacterActivitiesEntry(
const std::vector<CharacterActivities> &character_activitiess,
int character_activities_id
)
{
for (auto &character_activities : character_activitiess) {
if (character_activities.charid == character_activities_id) {
return character_activities;
}
}
return NewEntity();
}
static CharacterActivities FindOne(
int character_activities_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_activities_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterActivities entry{};
entry.charid = atoi(row[0]);
entry.taskid = atoi(row[1]);
entry.activityid = atoi(row[2]);
entry.donecount = atoi(row[3]);
entry.completed = atoi(row[4]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int character_activities_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_activities_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
CharacterActivities character_activities_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(character_activities_entry.charid));
update_values.push_back(columns[1] + " = " + std::to_string(character_activities_entry.taskid));
update_values.push_back(columns[2] + " = " + std::to_string(character_activities_entry.activityid));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_activities_entry.charid
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterActivities InsertOne(
CharacterActivities character_activities_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_activities_entry.charid));
insert_values.push_back(std::to_string(character_activities_entry.taskid));
insert_values.push_back(std::to_string(character_activities_entry.activityid));
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_activities_entry.charid = results.LastInsertedID();
return character_activities_entry;
}
character_activities_entry = NewEntity();
return character_activities_entry;
}
static int InsertMany(
std::vector<CharacterActivities> character_activities_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_activities_entry: character_activities_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_activities_entry.charid));
insert_values.push_back(std::to_string(character_activities_entry.taskid));
insert_values.push_back(std::to_string(character_activities_entry.activityid));
insert_values.push_back(std::to_string(character_activities_entry.donecount));
insert_values.push_back(std::to_string(character_activities_entry.completed));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterActivities> All()
{
std::vector<CharacterActivities> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterActivities entry{};
entry.charid = atoi(row[0]);
entry.taskid = atoi(row[1]);
entry.activityid = atoi(row[2]);
entry.donecount = atoi(row[3]);
entry.completed = atoi(row[4]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterActivities> GetWhere(std::string where_filter)
{
std::vector<CharacterActivities> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterActivities entry{};
entry.charid = atoi(row[0]);
entry.taskid = atoi(row[1]);
entry.activityid = atoi(row[2]);
entry.donecount = atoi(row[3]);
entry.completed = atoi(row[4]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = database.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_CHARACTER_ACTIVITIES_REPOSITORY_H
@@ -0,0 +1,329 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_CHARACTER_ALT_CURRENCY_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_ALT_CURRENCY_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterAltCurrencyRepository {
public:
struct CharacterAltCurrency {
int char_id;
int currency_id;
int amount;
};
static std::string PrimaryKey()
{
return std::string("char_id");
}
static std::vector<std::string> Columns()
{
return {
"char_id",
"currency_id",
"amount",
};
}
static std::string ColumnsRaw()
{
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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static CharacterAltCurrency NewEntity()
{
CharacterAltCurrency entry{};
entry.char_id = 0;
entry.currency_id = 0;
entry.amount = 0;
return entry;
}
static CharacterAltCurrency GetCharacterAltCurrencyEntry(
const std::vector<CharacterAltCurrency> &character_alt_currencys,
int character_alt_currency_id
)
{
for (auto &character_alt_currency : character_alt_currencys) {
if (character_alt_currency.char_id == character_alt_currency_id) {
return character_alt_currency;
}
}
return NewEntity();
}
static CharacterAltCurrency FindOne(
int character_alt_currency_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_alt_currency_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterAltCurrency entry{};
entry.char_id = atoi(row[0]);
entry.currency_id = atoi(row[1]);
entry.amount = atoi(row[2]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int character_alt_currency_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_alt_currency_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
CharacterAltCurrency character_alt_currency_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(character_alt_currency_entry.char_id));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_alt_currency_entry.char_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterAltCurrency InsertOne(
CharacterAltCurrency character_alt_currency_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_alt_currency_entry.char_id));
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_alt_currency_entry.char_id = results.LastInsertedID();
return character_alt_currency_entry;
}
character_alt_currency_entry = NewEntity();
return character_alt_currency_entry;
}
static int InsertMany(
std::vector<CharacterAltCurrency> character_alt_currency_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_alt_currency_entry: character_alt_currency_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_alt_currency_entry.char_id));
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));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterAltCurrency> All()
{
std::vector<CharacterAltCurrency> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterAltCurrency entry{};
entry.char_id = atoi(row[0]);
entry.currency_id = atoi(row[1]);
entry.amount = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterAltCurrency> GetWhere(std::string where_filter)
{
std::vector<CharacterAltCurrency> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterAltCurrency entry{};
entry.char_id = atoi(row[0]);
entry.currency_id = atoi(row[1]);
entry.amount = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = database.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_CHARACTER_ALT_CURRENCY_REPOSITORY_H
@@ -0,0 +1,338 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_CHARACTER_ALTERNATE_ABILITIES_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_ALTERNATE_ABILITIES_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterAlternateAbilitiesRepository {
public:
struct CharacterAlternateAbilities {
int id;
int aa_id;
int aa_value;
int charges;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"aa_id",
"aa_value",
"charges",
};
}
static std::string ColumnsRaw()
{
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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static CharacterAlternateAbilities NewEntity()
{
CharacterAlternateAbilities entry{};
entry.id = 0;
entry.aa_id = 0;
entry.aa_value = 0;
entry.charges = 0;
return entry;
}
static CharacterAlternateAbilities GetCharacterAlternateAbilitiesEntry(
const std::vector<CharacterAlternateAbilities> &character_alternate_abilitiess,
int character_alternate_abilities_id
)
{
for (auto &character_alternate_abilities : character_alternate_abilitiess) {
if (character_alternate_abilities.id == character_alternate_abilities_id) {
return character_alternate_abilities;
}
}
return NewEntity();
}
static CharacterAlternateAbilities FindOne(
int character_alternate_abilities_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_alternate_abilities_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterAlternateAbilities entry{};
entry.id = atoi(row[0]);
entry.aa_id = atoi(row[1]);
entry.aa_value = atoi(row[2]);
entry.charges = atoi(row[3]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int character_alternate_abilities_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_alternate_abilities_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
CharacterAlternateAbilities character_alternate_abilities_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(character_alternate_abilities_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(character_alternate_abilities_entry.aa_id));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_alternate_abilities_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterAlternateAbilities InsertOne(
CharacterAlternateAbilities character_alternate_abilities_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_alternate_abilities_entry.id));
insert_values.push_back(std::to_string(character_alternate_abilities_entry.aa_id));
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_alternate_abilities_entry.id = results.LastInsertedID();
return character_alternate_abilities_entry;
}
character_alternate_abilities_entry = NewEntity();
return character_alternate_abilities_entry;
}
static int InsertMany(
std::vector<CharacterAlternateAbilities> character_alternate_abilities_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_alternate_abilities_entry: character_alternate_abilities_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_alternate_abilities_entry.id));
insert_values.push_back(std::to_string(character_alternate_abilities_entry.aa_id));
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));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterAlternateAbilities> All()
{
std::vector<CharacterAlternateAbilities> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterAlternateAbilities entry{};
entry.id = atoi(row[0]);
entry.aa_id = atoi(row[1]);
entry.aa_value = atoi(row[2]);
entry.charges = atoi(row[3]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterAlternateAbilities> GetWhere(std::string where_filter)
{
std::vector<CharacterAlternateAbilities> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterAlternateAbilities entry{};
entry.id = atoi(row[0]);
entry.aa_id = atoi(row[1]);
entry.aa_value = atoi(row[2]);
entry.charges = atoi(row[3]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = database.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_CHARACTER_ALTERNATE_ABILITIES_REPOSITORY_H
@@ -0,0 +1,329 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_CHARACTER_AURAS_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_AURAS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterAurasRepository {
public:
struct CharacterAuras {
int id;
int slot;
int spell_id;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"slot",
"spell_id",
};
}
static std::string ColumnsRaw()
{
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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static CharacterAuras NewEntity()
{
CharacterAuras entry{};
entry.id = 0;
entry.slot = 0;
entry.spell_id = 0;
return entry;
}
static CharacterAuras GetCharacterAurasEntry(
const std::vector<CharacterAuras> &character_aurass,
int character_auras_id
)
{
for (auto &character_auras : character_aurass) {
if (character_auras.id == character_auras_id) {
return character_auras;
}
}
return NewEntity();
}
static CharacterAuras FindOne(
int character_auras_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_auras_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterAuras entry{};
entry.id = atoi(row[0]);
entry.slot = atoi(row[1]);
entry.spell_id = atoi(row[2]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int character_auras_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_auras_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
CharacterAuras character_auras_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(character_auras_entry.id));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_auras_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterAuras InsertOne(
CharacterAuras character_auras_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_auras_entry.id));
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_auras_entry.id = results.LastInsertedID();
return character_auras_entry;
}
character_auras_entry = NewEntity();
return character_auras_entry;
}
static int InsertMany(
std::vector<CharacterAuras> character_auras_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_auras_entry: character_auras_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_auras_entry.id));
insert_values.push_back(std::to_string(character_auras_entry.slot));
insert_values.push_back(std::to_string(character_auras_entry.spell_id));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterAuras> All()
{
std::vector<CharacterAuras> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterAuras entry{};
entry.id = atoi(row[0]);
entry.slot = atoi(row[1]);
entry.spell_id = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterAuras> GetWhere(std::string where_filter)
{
std::vector<CharacterAuras> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterAuras entry{};
entry.id = atoi(row[0]);
entry.slot = atoi(row[1]);
entry.spell_id = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = database.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_CHARACTER_AURAS_REPOSITORY_H
@@ -0,0 +1,356 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_CHARACTER_BANDOLIER_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_BANDOLIER_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterBandolierRepository {
public:
struct CharacterBandolier {
int id;
int bandolier_id;
int bandolier_slot;
int item_id;
int icon;
std::string bandolier_name;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"bandolier_id",
"bandolier_slot",
"item_id",
"icon",
"bandolier_name",
};
}
static std::string ColumnsRaw()
{
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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static CharacterBandolier NewEntity()
{
CharacterBandolier entry{};
entry.id = 0;
entry.bandolier_id = 0;
entry.bandolier_slot = 0;
entry.item_id = 0;
entry.icon = 0;
entry.bandolier_name = "0";
return entry;
}
static CharacterBandolier GetCharacterBandolierEntry(
const std::vector<CharacterBandolier> &character_bandoliers,
int character_bandolier_id
)
{
for (auto &character_bandolier : character_bandoliers) {
if (character_bandolier.id == character_bandolier_id) {
return character_bandolier;
}
}
return NewEntity();
}
static CharacterBandolier FindOne(
int character_bandolier_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_bandolier_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterBandolier entry{};
entry.id = atoi(row[0]);
entry.bandolier_id = atoi(row[1]);
entry.bandolier_slot = atoi(row[2]);
entry.item_id = atoi(row[3]);
entry.icon = atoi(row[4]);
entry.bandolier_name = row[5] ? row[5] : "";
return entry;
}
return NewEntity();
}
static int DeleteOne(
int character_bandolier_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_bandolier_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
CharacterBandolier character_bandolier_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(character_bandolier_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(character_bandolier_entry.bandolier_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_bandolier_entry.bandolier_slot));
update_values.push_back(columns[3] + " = " + std::to_string(character_bandolier_entry.item_id));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_bandolier_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterBandolier InsertOne(
CharacterBandolier character_bandolier_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_bandolier_entry.id));
insert_values.push_back(std::to_string(character_bandolier_entry.bandolier_id));
insert_values.push_back(std::to_string(character_bandolier_entry.bandolier_slot));
insert_values.push_back(std::to_string(character_bandolier_entry.item_id));
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_bandolier_entry.id = results.LastInsertedID();
return character_bandolier_entry;
}
character_bandolier_entry = NewEntity();
return character_bandolier_entry;
}
static int InsertMany(
std::vector<CharacterBandolier> character_bandolier_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_bandolier_entry: character_bandolier_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_bandolier_entry.id));
insert_values.push_back(std::to_string(character_bandolier_entry.bandolier_id));
insert_values.push_back(std::to_string(character_bandolier_entry.bandolier_slot));
insert_values.push_back(std::to_string(character_bandolier_entry.item_id));
insert_values.push_back(std::to_string(character_bandolier_entry.icon));
insert_values.push_back("'" + EscapeString(character_bandolier_entry.bandolier_name) + "'");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterBandolier> All()
{
std::vector<CharacterBandolier> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterBandolier entry{};
entry.id = atoi(row[0]);
entry.bandolier_id = atoi(row[1]);
entry.bandolier_slot = atoi(row[2]);
entry.item_id = atoi(row[3]);
entry.icon = atoi(row[4]);
entry.bandolier_name = row[5] ? row[5] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterBandolier> GetWhere(std::string where_filter)
{
std::vector<CharacterBandolier> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterBandolier entry{};
entry.id = atoi(row[0]);
entry.bandolier_id = atoi(row[1]);
entry.bandolier_slot = atoi(row[2]);
entry.item_id = atoi(row[3]);
entry.icon = atoi(row[4]);
entry.bandolier_name = row[5] ? row[5] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = database.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_CHARACTER_BANDOLIER_REPOSITORY_H
@@ -0,0 +1,371 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_CHARACTER_BIND_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_BIND_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterBindRepository {
public:
struct CharacterBind {
int id;
int slot;
int zone_id;
int instance_id;
float x;
float y;
float z;
float heading;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"slot",
"zone_id",
"instance_id",
"x",
"y",
"z",
"heading",
};
}
static std::string ColumnsRaw()
{
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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static CharacterBind NewEntity()
{
CharacterBind entry{};
entry.id = 0;
entry.slot = 0;
entry.zone_id = 0;
entry.instance_id = 0;
entry.x = 0;
entry.y = 0;
entry.z = 0;
entry.heading = 0;
return entry;
}
static CharacterBind GetCharacterBindEntry(
const std::vector<CharacterBind> &character_binds,
int character_bind_id
)
{
for (auto &character_bind : character_binds) {
if (character_bind.id == character_bind_id) {
return character_bind;
}
}
return NewEntity();
}
static CharacterBind FindOne(
int character_bind_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_bind_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterBind entry{};
entry.id = atoi(row[0]);
entry.slot = atoi(row[1]);
entry.zone_id = atoi(row[2]);
entry.instance_id = atoi(row[3]);
entry.x = static_cast<float>(atof(row[4]));
entry.y = static_cast<float>(atof(row[5]));
entry.z = static_cast<float>(atof(row[6]));
entry.heading = static_cast<float>(atof(row[7]));
return entry;
}
return NewEntity();
}
static int DeleteOne(
int character_bind_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_bind_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
CharacterBind character_bind_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[1] + " = " + std::to_string(character_bind_entry.slot));
update_values.push_back(columns[2] + " = " + std::to_string(character_bind_entry.zone_id));
update_values.push_back(columns[3] + " = " + std::to_string(character_bind_entry.instance_id));
update_values.push_back(columns[4] + " = " + std::to_string(character_bind_entry.x));
update_values.push_back(columns[5] + " = " + std::to_string(character_bind_entry.y));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_bind_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterBind InsertOne(
CharacterBind character_bind_entry
)
{
std::vector<std::string> insert_values;
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));
insert_values.push_back(std::to_string(character_bind_entry.x));
insert_values.push_back(std::to_string(character_bind_entry.y));
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_bind_entry.id = results.LastInsertedID();
return character_bind_entry;
}
character_bind_entry = NewEntity();
return character_bind_entry;
}
static int InsertMany(
std::vector<CharacterBind> character_bind_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_bind_entry: character_bind_entries) {
std::vector<std::string> insert_values;
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));
insert_values.push_back(std::to_string(character_bind_entry.x));
insert_values.push_back(std::to_string(character_bind_entry.y));
insert_values.push_back(std::to_string(character_bind_entry.z));
insert_values.push_back(std::to_string(character_bind_entry.heading));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterBind> All()
{
std::vector<CharacterBind> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterBind entry{};
entry.id = atoi(row[0]);
entry.slot = atoi(row[1]);
entry.zone_id = atoi(row[2]);
entry.instance_id = atoi(row[3]);
entry.x = static_cast<float>(atof(row[4]));
entry.y = static_cast<float>(atof(row[5]));
entry.z = static_cast<float>(atof(row[6]));
entry.heading = static_cast<float>(atof(row[7]));
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterBind> GetWhere(std::string where_filter)
{
std::vector<CharacterBind> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterBind entry{};
entry.id = atoi(row[0]);
entry.slot = atoi(row[1]);
entry.zone_id = atoi(row[2]);
entry.instance_id = atoi(row[3]);
entry.x = static_cast<float>(atof(row[4]));
entry.y = static_cast<float>(atof(row[5]));
entry.z = static_cast<float>(atof(row[6]));
entry.heading = static_cast<float>(atof(row[7]));
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = database.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_CHARACTER_BIND_REPOSITORY_H
@@ -0,0 +1,455 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_CHARACTER_BUFFS_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_BUFFS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterBuffsRepository {
public:
struct CharacterBuffs {
int character_id;
int slot_id;
int spell_id;
int caster_level;
std::string caster_name;
int ticsremaining;
int counters;
int numhits;
int melee_rune;
int magic_rune;
int persistent;
int dot_rune;
int caston_x;
int caston_y;
int caston_z;
int ExtraDIChance;
int instrument_mod;
};
static std::string PrimaryKey()
{
return std::string("character_id");
}
static std::vector<std::string> Columns()
{
return {
"character_id",
"slot_id",
"spell_id",
"caster_level",
"caster_name",
"ticsremaining",
"counters",
"numhits",
"melee_rune",
"magic_rune",
"persistent",
"dot_rune",
"caston_x",
"caston_y",
"caston_z",
"ExtraDIChance",
"instrument_mod",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string 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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static CharacterBuffs NewEntity()
{
CharacterBuffs entry{};
entry.character_id = 0;
entry.slot_id = 0;
entry.spell_id = 0;
entry.caster_level = 0;
entry.caster_name = "";
entry.ticsremaining = 0;
entry.counters = 0;
entry.numhits = 0;
entry.melee_rune = 0;
entry.magic_rune = 0;
entry.persistent = 0;
entry.dot_rune = 0;
entry.caston_x = 0;
entry.caston_y = 0;
entry.caston_z = 0;
entry.ExtraDIChance = 0;
entry.instrument_mod = 10;
return entry;
}
static CharacterBuffs GetCharacterBuffsEntry(
const std::vector<CharacterBuffs> &character_buffss,
int character_buffs_id
)
{
for (auto &character_buffs : character_buffss) {
if (character_buffs.character_id == character_buffs_id) {
return character_buffs;
}
}
return NewEntity();
}
static CharacterBuffs FindOne(
int character_buffs_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_buffs_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterBuffs entry{};
entry.character_id = atoi(row[0]);
entry.slot_id = atoi(row[1]);
entry.spell_id = atoi(row[2]);
entry.caster_level = atoi(row[3]);
entry.caster_name = row[4] ? row[4] : "";
entry.ticsremaining = atoi(row[5]);
entry.counters = atoi(row[6]);
entry.numhits = atoi(row[7]);
entry.melee_rune = atoi(row[8]);
entry.magic_rune = atoi(row[9]);
entry.persistent = atoi(row[10]);
entry.dot_rune = atoi(row[11]);
entry.caston_x = atoi(row[12]);
entry.caston_y = atoi(row[13]);
entry.caston_z = atoi(row[14]);
entry.ExtraDIChance = atoi(row[15]);
entry.instrument_mod = atoi(row[16]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int character_buffs_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_buffs_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
CharacterBuffs character_buffs_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(character_buffs_entry.character_id));
update_values.push_back(columns[1] + " = " + std::to_string(character_buffs_entry.slot_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_buffs_entry.spell_id));
update_values.push_back(columns[3] + " = " + std::to_string(character_buffs_entry.caster_level));
update_values.push_back(columns[4] + " = '" + EscapeString(character_buffs_entry.caster_name) + "'");
update_values.push_back(columns[5] + " = " + std::to_string(character_buffs_entry.ticsremaining));
update_values.push_back(columns[6] + " = " + std::to_string(character_buffs_entry.counters));
update_values.push_back(columns[7] + " = " + std::to_string(character_buffs_entry.numhits));
update_values.push_back(columns[8] + " = " + std::to_string(character_buffs_entry.melee_rune));
update_values.push_back(columns[9] + " = " + std::to_string(character_buffs_entry.magic_rune));
update_values.push_back(columns[10] + " = " + std::to_string(character_buffs_entry.persistent));
update_values.push_back(columns[11] + " = " + std::to_string(character_buffs_entry.dot_rune));
update_values.push_back(columns[12] + " = " + std::to_string(character_buffs_entry.caston_x));
update_values.push_back(columns[13] + " = " + std::to_string(character_buffs_entry.caston_y));
update_values.push_back(columns[14] + " = " + std::to_string(character_buffs_entry.caston_z));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_buffs_entry.character_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterBuffs InsertOne(
CharacterBuffs character_buffs_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_buffs_entry.character_id));
insert_values.push_back(std::to_string(character_buffs_entry.slot_id));
insert_values.push_back(std::to_string(character_buffs_entry.spell_id));
insert_values.push_back(std::to_string(character_buffs_entry.caster_level));
insert_values.push_back("'" + EscapeString(character_buffs_entry.caster_name) + "'");
insert_values.push_back(std::to_string(character_buffs_entry.ticsremaining));
insert_values.push_back(std::to_string(character_buffs_entry.counters));
insert_values.push_back(std::to_string(character_buffs_entry.numhits));
insert_values.push_back(std::to_string(character_buffs_entry.melee_rune));
insert_values.push_back(std::to_string(character_buffs_entry.magic_rune));
insert_values.push_back(std::to_string(character_buffs_entry.persistent));
insert_values.push_back(std::to_string(character_buffs_entry.dot_rune));
insert_values.push_back(std::to_string(character_buffs_entry.caston_x));
insert_values.push_back(std::to_string(character_buffs_entry.caston_y));
insert_values.push_back(std::to_string(character_buffs_entry.caston_z));
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_buffs_entry.character_id = results.LastInsertedID();
return character_buffs_entry;
}
character_buffs_entry = NewEntity();
return character_buffs_entry;
}
static int InsertMany(
std::vector<CharacterBuffs> character_buffs_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_buffs_entry: character_buffs_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_buffs_entry.character_id));
insert_values.push_back(std::to_string(character_buffs_entry.slot_id));
insert_values.push_back(std::to_string(character_buffs_entry.spell_id));
insert_values.push_back(std::to_string(character_buffs_entry.caster_level));
insert_values.push_back("'" + EscapeString(character_buffs_entry.caster_name) + "'");
insert_values.push_back(std::to_string(character_buffs_entry.ticsremaining));
insert_values.push_back(std::to_string(character_buffs_entry.counters));
insert_values.push_back(std::to_string(character_buffs_entry.numhits));
insert_values.push_back(std::to_string(character_buffs_entry.melee_rune));
insert_values.push_back(std::to_string(character_buffs_entry.magic_rune));
insert_values.push_back(std::to_string(character_buffs_entry.persistent));
insert_values.push_back(std::to_string(character_buffs_entry.dot_rune));
insert_values.push_back(std::to_string(character_buffs_entry.caston_x));
insert_values.push_back(std::to_string(character_buffs_entry.caston_y));
insert_values.push_back(std::to_string(character_buffs_entry.caston_z));
insert_values.push_back(std::to_string(character_buffs_entry.ExtraDIChance));
insert_values.push_back(std::to_string(character_buffs_entry.instrument_mod));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterBuffs> All()
{
std::vector<CharacterBuffs> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterBuffs entry{};
entry.character_id = atoi(row[0]);
entry.slot_id = atoi(row[1]);
entry.spell_id = atoi(row[2]);
entry.caster_level = atoi(row[3]);
entry.caster_name = row[4] ? row[4] : "";
entry.ticsremaining = atoi(row[5]);
entry.counters = atoi(row[6]);
entry.numhits = atoi(row[7]);
entry.melee_rune = atoi(row[8]);
entry.magic_rune = atoi(row[9]);
entry.persistent = atoi(row[10]);
entry.dot_rune = atoi(row[11]);
entry.caston_x = atoi(row[12]);
entry.caston_y = atoi(row[13]);
entry.caston_z = atoi(row[14]);
entry.ExtraDIChance = atoi(row[15]);
entry.instrument_mod = atoi(row[16]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterBuffs> GetWhere(std::string where_filter)
{
std::vector<CharacterBuffs> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterBuffs entry{};
entry.character_id = atoi(row[0]);
entry.slot_id = atoi(row[1]);
entry.spell_id = atoi(row[2]);
entry.caster_level = atoi(row[3]);
entry.caster_name = row[4] ? row[4] : "";
entry.ticsremaining = atoi(row[5]);
entry.counters = atoi(row[6]);
entry.numhits = atoi(row[7]);
entry.melee_rune = atoi(row[8]);
entry.magic_rune = atoi(row[9]);
entry.persistent = atoi(row[10]);
entry.dot_rune = atoi(row[11]);
entry.caston_x = atoi(row[12]);
entry.caston_y = atoi(row[13]);
entry.caston_z = atoi(row[14]);
entry.ExtraDIChance = atoi(row[15]);
entry.instrument_mod = atoi(row[16]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = database.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_CHARACTER_BUFFS_REPOSITORY_H
@@ -0,0 +1,401 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_CHARACTER_CORPSE_ITEMS_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_CORPSE_ITEMS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterCorpseItemsRepository {
public:
struct CharacterCorpseItems {
int corpse_id;
int equip_slot;
int item_id;
int charges;
int aug_1;
int aug_2;
int aug_3;
int aug_4;
int aug_5;
int aug_6;
int attuned;
};
static std::string PrimaryKey()
{
return std::string("corpse_id");
}
static std::vector<std::string> Columns()
{
return {
"corpse_id",
"equip_slot",
"item_id",
"charges",
"aug_1",
"aug_2",
"aug_3",
"aug_4",
"aug_5",
"aug_6",
"attuned",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string 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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static CharacterCorpseItems NewEntity()
{
CharacterCorpseItems entry{};
entry.corpse_id = 0;
entry.equip_slot = 0;
entry.item_id = 0;
entry.charges = 0;
entry.aug_1 = 0;
entry.aug_2 = 0;
entry.aug_3 = 0;
entry.aug_4 = 0;
entry.aug_5 = 0;
entry.aug_6 = 0;
entry.attuned = 0;
return entry;
}
static CharacterCorpseItems GetCharacterCorpseItemsEntry(
const std::vector<CharacterCorpseItems> &character_corpse_itemss,
int character_corpse_items_id
)
{
for (auto &character_corpse_items : character_corpse_itemss) {
if (character_corpse_items.corpse_id == character_corpse_items_id) {
return character_corpse_items;
}
}
return NewEntity();
}
static CharacterCorpseItems FindOne(
int character_corpse_items_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_corpse_items_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterCorpseItems entry{};
entry.corpse_id = atoi(row[0]);
entry.equip_slot = atoi(row[1]);
entry.item_id = atoi(row[2]);
entry.charges = atoi(row[3]);
entry.aug_1 = atoi(row[4]);
entry.aug_2 = atoi(row[5]);
entry.aug_3 = atoi(row[6]);
entry.aug_4 = atoi(row[7]);
entry.aug_5 = atoi(row[8]);
entry.aug_6 = atoi(row[9]);
entry.attuned = atoi(row[10]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int character_corpse_items_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_corpse_items_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
CharacterCorpseItems character_corpse_items_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(character_corpse_items_entry.corpse_id));
update_values.push_back(columns[1] + " = " + std::to_string(character_corpse_items_entry.equip_slot));
update_values.push_back(columns[2] + " = " + std::to_string(character_corpse_items_entry.item_id));
update_values.push_back(columns[3] + " = " + std::to_string(character_corpse_items_entry.charges));
update_values.push_back(columns[4] + " = " + std::to_string(character_corpse_items_entry.aug_1));
update_values.push_back(columns[5] + " = " + std::to_string(character_corpse_items_entry.aug_2));
update_values.push_back(columns[6] + " = " + std::to_string(character_corpse_items_entry.aug_3));
update_values.push_back(columns[7] + " = " + std::to_string(character_corpse_items_entry.aug_4));
update_values.push_back(columns[8] + " = " + std::to_string(character_corpse_items_entry.aug_5));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_corpse_items_entry.corpse_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterCorpseItems InsertOne(
CharacterCorpseItems character_corpse_items_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_corpse_items_entry.corpse_id));
insert_values.push_back(std::to_string(character_corpse_items_entry.equip_slot));
insert_values.push_back(std::to_string(character_corpse_items_entry.item_id));
insert_values.push_back(std::to_string(character_corpse_items_entry.charges));
insert_values.push_back(std::to_string(character_corpse_items_entry.aug_1));
insert_values.push_back(std::to_string(character_corpse_items_entry.aug_2));
insert_values.push_back(std::to_string(character_corpse_items_entry.aug_3));
insert_values.push_back(std::to_string(character_corpse_items_entry.aug_4));
insert_values.push_back(std::to_string(character_corpse_items_entry.aug_5));
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_corpse_items_entry.corpse_id = results.LastInsertedID();
return character_corpse_items_entry;
}
character_corpse_items_entry = NewEntity();
return character_corpse_items_entry;
}
static int InsertMany(
std::vector<CharacterCorpseItems> character_corpse_items_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_corpse_items_entry: character_corpse_items_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_corpse_items_entry.corpse_id));
insert_values.push_back(std::to_string(character_corpse_items_entry.equip_slot));
insert_values.push_back(std::to_string(character_corpse_items_entry.item_id));
insert_values.push_back(std::to_string(character_corpse_items_entry.charges));
insert_values.push_back(std::to_string(character_corpse_items_entry.aug_1));
insert_values.push_back(std::to_string(character_corpse_items_entry.aug_2));
insert_values.push_back(std::to_string(character_corpse_items_entry.aug_3));
insert_values.push_back(std::to_string(character_corpse_items_entry.aug_4));
insert_values.push_back(std::to_string(character_corpse_items_entry.aug_5));
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));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterCorpseItems> All()
{
std::vector<CharacterCorpseItems> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterCorpseItems entry{};
entry.corpse_id = atoi(row[0]);
entry.equip_slot = atoi(row[1]);
entry.item_id = atoi(row[2]);
entry.charges = atoi(row[3]);
entry.aug_1 = atoi(row[4]);
entry.aug_2 = atoi(row[5]);
entry.aug_3 = atoi(row[6]);
entry.aug_4 = atoi(row[7]);
entry.aug_5 = atoi(row[8]);
entry.aug_6 = atoi(row[9]);
entry.attuned = atoi(row[10]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterCorpseItems> GetWhere(std::string where_filter)
{
std::vector<CharacterCorpseItems> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterCorpseItems entry{};
entry.corpse_id = atoi(row[0]);
entry.equip_slot = atoi(row[1]);
entry.item_id = atoi(row[2]);
entry.charges = atoi(row[3]);
entry.aug_1 = atoi(row[4]);
entry.aug_2 = atoi(row[5]);
entry.aug_3 = atoi(row[6]);
entry.aug_4 = atoi(row[7]);
entry.aug_5 = atoi(row[8]);
entry.aug_6 = atoi(row[9]);
entry.attuned = atoi(row[10]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = database.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_CHARACTER_CORPSE_ITEMS_REPOSITORY_H
@@ -0,0 +1,722 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_CHARACTER_CORPSES_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_CORPSES_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterCorpsesRepository {
public:
struct CharacterCorpses {
int id;
int charid;
std::string charname;
int zone_id;
int instance_id;
float x;
float y;
float z;
float heading;
std::string time_of_death;
int guild_consent_id;
int is_rezzed;
int is_buried;
int was_at_graveyard;
int is_locked;
int exp;
int size;
int level;
int race;
int gender;
int class;
int deity;
int texture;
int helm_texture;
int copper;
int silver;
int gold;
int platinum;
int hair_color;
int beard_color;
int eye_color_1;
int eye_color_2;
int hair_style;
int face;
int beard;
int drakkin_heritage;
int drakkin_tattoo;
int drakkin_details;
int wc_1;
int wc_2;
int wc_3;
int wc_4;
int wc_5;
int wc_6;
int wc_7;
int wc_8;
int wc_9;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"charid",
"charname",
"zone_id",
"instance_id",
"x",
"y",
"z",
"heading",
"time_of_death",
"guild_consent_id",
"is_rezzed",
"is_buried",
"was_at_graveyard",
"is_locked",
"exp",
"size",
"level",
"race",
"gender",
"class",
"deity",
"texture",
"helm_texture",
"copper",
"silver",
"gold",
"platinum",
"hair_color",
"beard_color",
"eye_color_1",
"eye_color_2",
"hair_style",
"face",
"beard",
"drakkin_heritage",
"drakkin_tattoo",
"drakkin_details",
"wc_1",
"wc_2",
"wc_3",
"wc_4",
"wc_5",
"wc_6",
"wc_7",
"wc_8",
"wc_9",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string 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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static CharacterCorpses NewEntity()
{
CharacterCorpses entry{};
entry.id = 0;
entry.charid = 0;
entry.charname = "";
entry.zone_id = 0;
entry.instance_id = 0;
entry.x = 0;
entry.y = 0;
entry.z = 0;
entry.heading = 0;
entry.time_of_death = "0000-00-00 00:00:00";
entry.guild_consent_id = 0;
entry.is_rezzed = 0;
entry.is_buried = 0;
entry.was_at_graveyard = 0;
entry.is_locked = 0;
entry.exp = 0;
entry.size = 0;
entry.level = 0;
entry.race = 0;
entry.gender = 0;
entry.class = 0;
entry.deity = 0;
entry.texture = 0;
entry.helm_texture = 0;
entry.copper = 0;
entry.silver = 0;
entry.gold = 0;
entry.platinum = 0;
entry.hair_color = 0;
entry.beard_color = 0;
entry.eye_color_1 = 0;
entry.eye_color_2 = 0;
entry.hair_style = 0;
entry.face = 0;
entry.beard = 0;
entry.drakkin_heritage = 0;
entry.drakkin_tattoo = 0;
entry.drakkin_details = 0;
entry.wc_1 = 0;
entry.wc_2 = 0;
entry.wc_3 = 0;
entry.wc_4 = 0;
entry.wc_5 = 0;
entry.wc_6 = 0;
entry.wc_7 = 0;
entry.wc_8 = 0;
entry.wc_9 = 0;
return entry;
}
static CharacterCorpses GetCharacterCorpsesEntry(
const std::vector<CharacterCorpses> &character_corpsess,
int character_corpses_id
)
{
for (auto &character_corpses : character_corpsess) {
if (character_corpses.id == character_corpses_id) {
return character_corpses;
}
}
return NewEntity();
}
static CharacterCorpses FindOne(
int character_corpses_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_corpses_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterCorpses entry{};
entry.id = atoi(row[0]);
entry.charid = atoi(row[1]);
entry.charname = row[2] ? row[2] : "";
entry.zone_id = atoi(row[3]);
entry.instance_id = atoi(row[4]);
entry.x = static_cast<float>(atof(row[5]));
entry.y = static_cast<float>(atof(row[6]));
entry.z = static_cast<float>(atof(row[7]));
entry.heading = static_cast<float>(atof(row[8]));
entry.time_of_death = row[9] ? row[9] : "";
entry.guild_consent_id = atoi(row[10]);
entry.is_rezzed = atoi(row[11]);
entry.is_buried = atoi(row[12]);
entry.was_at_graveyard = atoi(row[13]);
entry.is_locked = atoi(row[14]);
entry.exp = atoi(row[15]);
entry.size = atoi(row[16]);
entry.level = atoi(row[17]);
entry.race = atoi(row[18]);
entry.gender = atoi(row[19]);
entry.class = atoi(row[20]);
entry.deity = atoi(row[21]);
entry.texture = atoi(row[22]);
entry.helm_texture = atoi(row[23]);
entry.copper = atoi(row[24]);
entry.silver = atoi(row[25]);
entry.gold = atoi(row[26]);
entry.platinum = atoi(row[27]);
entry.hair_color = atoi(row[28]);
entry.beard_color = atoi(row[29]);
entry.eye_color_1 = atoi(row[30]);
entry.eye_color_2 = atoi(row[31]);
entry.hair_style = atoi(row[32]);
entry.face = atoi(row[33]);
entry.beard = atoi(row[34]);
entry.drakkin_heritage = atoi(row[35]);
entry.drakkin_tattoo = atoi(row[36]);
entry.drakkin_details = atoi(row[37]);
entry.wc_1 = atoi(row[38]);
entry.wc_2 = atoi(row[39]);
entry.wc_3 = atoi(row[40]);
entry.wc_4 = atoi(row[41]);
entry.wc_5 = atoi(row[42]);
entry.wc_6 = atoi(row[43]);
entry.wc_7 = atoi(row[44]);
entry.wc_8 = atoi(row[45]);
entry.wc_9 = atoi(row[46]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int character_corpses_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_corpses_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
CharacterCorpses character_corpses_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[1] + " = " + std::to_string(character_corpses_entry.charid));
update_values.push_back(columns[2] + " = '" + EscapeString(character_corpses_entry.charname) + "'");
update_values.push_back(columns[3] + " = " + std::to_string(character_corpses_entry.zone_id));
update_values.push_back(columns[4] + " = " + std::to_string(character_corpses_entry.instance_id));
update_values.push_back(columns[5] + " = " + std::to_string(character_corpses_entry.x));
update_values.push_back(columns[6] + " = " + std::to_string(character_corpses_entry.y));
update_values.push_back(columns[7] + " = " + std::to_string(character_corpses_entry.z));
update_values.push_back(columns[8] + " = " + std::to_string(character_corpses_entry.heading));
update_values.push_back(columns[9] + " = '" + EscapeString(character_corpses_entry.time_of_death) + "'");
update_values.push_back(columns[10] + " = " + std::to_string(character_corpses_entry.guild_consent_id));
update_values.push_back(columns[11] + " = " + std::to_string(character_corpses_entry.is_rezzed));
update_values.push_back(columns[12] + " = " + std::to_string(character_corpses_entry.is_buried));
update_values.push_back(columns[13] + " = " + std::to_string(character_corpses_entry.was_at_graveyard));
update_values.push_back(columns[14] + " = " + std::to_string(character_corpses_entry.is_locked));
update_values.push_back(columns[15] + " = " + std::to_string(character_corpses_entry.exp));
update_values.push_back(columns[16] + " = " + std::to_string(character_corpses_entry.size));
update_values.push_back(columns[17] + " = " + std::to_string(character_corpses_entry.level));
update_values.push_back(columns[18] + " = " + std::to_string(character_corpses_entry.race));
update_values.push_back(columns[19] + " = " + std::to_string(character_corpses_entry.gender));
update_values.push_back(columns[20] + " = " + std::to_string(character_corpses_entry.class));
update_values.push_back(columns[21] + " = " + std::to_string(character_corpses_entry.deity));
update_values.push_back(columns[22] + " = " + std::to_string(character_corpses_entry.texture));
update_values.push_back(columns[23] + " = " + std::to_string(character_corpses_entry.helm_texture));
update_values.push_back(columns[24] + " = " + std::to_string(character_corpses_entry.copper));
update_values.push_back(columns[25] + " = " + std::to_string(character_corpses_entry.silver));
update_values.push_back(columns[26] + " = " + std::to_string(character_corpses_entry.gold));
update_values.push_back(columns[27] + " = " + std::to_string(character_corpses_entry.platinum));
update_values.push_back(columns[28] + " = " + std::to_string(character_corpses_entry.hair_color));
update_values.push_back(columns[29] + " = " + std::to_string(character_corpses_entry.beard_color));
update_values.push_back(columns[30] + " = " + std::to_string(character_corpses_entry.eye_color_1));
update_values.push_back(columns[31] + " = " + std::to_string(character_corpses_entry.eye_color_2));
update_values.push_back(columns[32] + " = " + std::to_string(character_corpses_entry.hair_style));
update_values.push_back(columns[33] + " = " + std::to_string(character_corpses_entry.face));
update_values.push_back(columns[34] + " = " + std::to_string(character_corpses_entry.beard));
update_values.push_back(columns[35] + " = " + std::to_string(character_corpses_entry.drakkin_heritage));
update_values.push_back(columns[36] + " = " + std::to_string(character_corpses_entry.drakkin_tattoo));
update_values.push_back(columns[37] + " = " + std::to_string(character_corpses_entry.drakkin_details));
update_values.push_back(columns[38] + " = " + std::to_string(character_corpses_entry.wc_1));
update_values.push_back(columns[39] + " = " + std::to_string(character_corpses_entry.wc_2));
update_values.push_back(columns[40] + " = " + std::to_string(character_corpses_entry.wc_3));
update_values.push_back(columns[41] + " = " + std::to_string(character_corpses_entry.wc_4));
update_values.push_back(columns[42] + " = " + std::to_string(character_corpses_entry.wc_5));
update_values.push_back(columns[43] + " = " + std::to_string(character_corpses_entry.wc_6));
update_values.push_back(columns[44] + " = " + std::to_string(character_corpses_entry.wc_7));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_corpses_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterCorpses InsertOne(
CharacterCorpses character_corpses_entry
)
{
std::vector<std::string> insert_values;
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));
insert_values.push_back(std::to_string(character_corpses_entry.instance_id));
insert_values.push_back(std::to_string(character_corpses_entry.x));
insert_values.push_back(std::to_string(character_corpses_entry.y));
insert_values.push_back(std::to_string(character_corpses_entry.z));
insert_values.push_back(std::to_string(character_corpses_entry.heading));
insert_values.push_back("'" + EscapeString(character_corpses_entry.time_of_death) + "'");
insert_values.push_back(std::to_string(character_corpses_entry.guild_consent_id));
insert_values.push_back(std::to_string(character_corpses_entry.is_rezzed));
insert_values.push_back(std::to_string(character_corpses_entry.is_buried));
insert_values.push_back(std::to_string(character_corpses_entry.was_at_graveyard));
insert_values.push_back(std::to_string(character_corpses_entry.is_locked));
insert_values.push_back(std::to_string(character_corpses_entry.exp));
insert_values.push_back(std::to_string(character_corpses_entry.size));
insert_values.push_back(std::to_string(character_corpses_entry.level));
insert_values.push_back(std::to_string(character_corpses_entry.race));
insert_values.push_back(std::to_string(character_corpses_entry.gender));
insert_values.push_back(std::to_string(character_corpses_entry.class));
insert_values.push_back(std::to_string(character_corpses_entry.deity));
insert_values.push_back(std::to_string(character_corpses_entry.texture));
insert_values.push_back(std::to_string(character_corpses_entry.helm_texture));
insert_values.push_back(std::to_string(character_corpses_entry.copper));
insert_values.push_back(std::to_string(character_corpses_entry.silver));
insert_values.push_back(std::to_string(character_corpses_entry.gold));
insert_values.push_back(std::to_string(character_corpses_entry.platinum));
insert_values.push_back(std::to_string(character_corpses_entry.hair_color));
insert_values.push_back(std::to_string(character_corpses_entry.beard_color));
insert_values.push_back(std::to_string(character_corpses_entry.eye_color_1));
insert_values.push_back(std::to_string(character_corpses_entry.eye_color_2));
insert_values.push_back(std::to_string(character_corpses_entry.hair_style));
insert_values.push_back(std::to_string(character_corpses_entry.face));
insert_values.push_back(std::to_string(character_corpses_entry.beard));
insert_values.push_back(std::to_string(character_corpses_entry.drakkin_heritage));
insert_values.push_back(std::to_string(character_corpses_entry.drakkin_tattoo));
insert_values.push_back(std::to_string(character_corpses_entry.drakkin_details));
insert_values.push_back(std::to_string(character_corpses_entry.wc_1));
insert_values.push_back(std::to_string(character_corpses_entry.wc_2));
insert_values.push_back(std::to_string(character_corpses_entry.wc_3));
insert_values.push_back(std::to_string(character_corpses_entry.wc_4));
insert_values.push_back(std::to_string(character_corpses_entry.wc_5));
insert_values.push_back(std::to_string(character_corpses_entry.wc_6));
insert_values.push_back(std::to_string(character_corpses_entry.wc_7));
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_corpses_entry.id = results.LastInsertedID();
return character_corpses_entry;
}
character_corpses_entry = NewEntity();
return character_corpses_entry;
}
static int InsertMany(
std::vector<CharacterCorpses> character_corpses_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_corpses_entry: character_corpses_entries) {
std::vector<std::string> insert_values;
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));
insert_values.push_back(std::to_string(character_corpses_entry.instance_id));
insert_values.push_back(std::to_string(character_corpses_entry.x));
insert_values.push_back(std::to_string(character_corpses_entry.y));
insert_values.push_back(std::to_string(character_corpses_entry.z));
insert_values.push_back(std::to_string(character_corpses_entry.heading));
insert_values.push_back("'" + EscapeString(character_corpses_entry.time_of_death) + "'");
insert_values.push_back(std::to_string(character_corpses_entry.guild_consent_id));
insert_values.push_back(std::to_string(character_corpses_entry.is_rezzed));
insert_values.push_back(std::to_string(character_corpses_entry.is_buried));
insert_values.push_back(std::to_string(character_corpses_entry.was_at_graveyard));
insert_values.push_back(std::to_string(character_corpses_entry.is_locked));
insert_values.push_back(std::to_string(character_corpses_entry.exp));
insert_values.push_back(std::to_string(character_corpses_entry.size));
insert_values.push_back(std::to_string(character_corpses_entry.level));
insert_values.push_back(std::to_string(character_corpses_entry.race));
insert_values.push_back(std::to_string(character_corpses_entry.gender));
insert_values.push_back(std::to_string(character_corpses_entry.class));
insert_values.push_back(std::to_string(character_corpses_entry.deity));
insert_values.push_back(std::to_string(character_corpses_entry.texture));
insert_values.push_back(std::to_string(character_corpses_entry.helm_texture));
insert_values.push_back(std::to_string(character_corpses_entry.copper));
insert_values.push_back(std::to_string(character_corpses_entry.silver));
insert_values.push_back(std::to_string(character_corpses_entry.gold));
insert_values.push_back(std::to_string(character_corpses_entry.platinum));
insert_values.push_back(std::to_string(character_corpses_entry.hair_color));
insert_values.push_back(std::to_string(character_corpses_entry.beard_color));
insert_values.push_back(std::to_string(character_corpses_entry.eye_color_1));
insert_values.push_back(std::to_string(character_corpses_entry.eye_color_2));
insert_values.push_back(std::to_string(character_corpses_entry.hair_style));
insert_values.push_back(std::to_string(character_corpses_entry.face));
insert_values.push_back(std::to_string(character_corpses_entry.beard));
insert_values.push_back(std::to_string(character_corpses_entry.drakkin_heritage));
insert_values.push_back(std::to_string(character_corpses_entry.drakkin_tattoo));
insert_values.push_back(std::to_string(character_corpses_entry.drakkin_details));
insert_values.push_back(std::to_string(character_corpses_entry.wc_1));
insert_values.push_back(std::to_string(character_corpses_entry.wc_2));
insert_values.push_back(std::to_string(character_corpses_entry.wc_3));
insert_values.push_back(std::to_string(character_corpses_entry.wc_4));
insert_values.push_back(std::to_string(character_corpses_entry.wc_5));
insert_values.push_back(std::to_string(character_corpses_entry.wc_6));
insert_values.push_back(std::to_string(character_corpses_entry.wc_7));
insert_values.push_back(std::to_string(character_corpses_entry.wc_8));
insert_values.push_back(std::to_string(character_corpses_entry.wc_9));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterCorpses> All()
{
std::vector<CharacterCorpses> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterCorpses entry{};
entry.id = atoi(row[0]);
entry.charid = atoi(row[1]);
entry.charname = row[2] ? row[2] : "";
entry.zone_id = atoi(row[3]);
entry.instance_id = atoi(row[4]);
entry.x = static_cast<float>(atof(row[5]));
entry.y = static_cast<float>(atof(row[6]));
entry.z = static_cast<float>(atof(row[7]));
entry.heading = static_cast<float>(atof(row[8]));
entry.time_of_death = row[9] ? row[9] : "";
entry.guild_consent_id = atoi(row[10]);
entry.is_rezzed = atoi(row[11]);
entry.is_buried = atoi(row[12]);
entry.was_at_graveyard = atoi(row[13]);
entry.is_locked = atoi(row[14]);
entry.exp = atoi(row[15]);
entry.size = atoi(row[16]);
entry.level = atoi(row[17]);
entry.race = atoi(row[18]);
entry.gender = atoi(row[19]);
entry.class = atoi(row[20]);
entry.deity = atoi(row[21]);
entry.texture = atoi(row[22]);
entry.helm_texture = atoi(row[23]);
entry.copper = atoi(row[24]);
entry.silver = atoi(row[25]);
entry.gold = atoi(row[26]);
entry.platinum = atoi(row[27]);
entry.hair_color = atoi(row[28]);
entry.beard_color = atoi(row[29]);
entry.eye_color_1 = atoi(row[30]);
entry.eye_color_2 = atoi(row[31]);
entry.hair_style = atoi(row[32]);
entry.face = atoi(row[33]);
entry.beard = atoi(row[34]);
entry.drakkin_heritage = atoi(row[35]);
entry.drakkin_tattoo = atoi(row[36]);
entry.drakkin_details = atoi(row[37]);
entry.wc_1 = atoi(row[38]);
entry.wc_2 = atoi(row[39]);
entry.wc_3 = atoi(row[40]);
entry.wc_4 = atoi(row[41]);
entry.wc_5 = atoi(row[42]);
entry.wc_6 = atoi(row[43]);
entry.wc_7 = atoi(row[44]);
entry.wc_8 = atoi(row[45]);
entry.wc_9 = atoi(row[46]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterCorpses> GetWhere(std::string where_filter)
{
std::vector<CharacterCorpses> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterCorpses entry{};
entry.id = atoi(row[0]);
entry.charid = atoi(row[1]);
entry.charname = row[2] ? row[2] : "";
entry.zone_id = atoi(row[3]);
entry.instance_id = atoi(row[4]);
entry.x = static_cast<float>(atof(row[5]));
entry.y = static_cast<float>(atof(row[6]));
entry.z = static_cast<float>(atof(row[7]));
entry.heading = static_cast<float>(atof(row[8]));
entry.time_of_death = row[9] ? row[9] : "";
entry.guild_consent_id = atoi(row[10]);
entry.is_rezzed = atoi(row[11]);
entry.is_buried = atoi(row[12]);
entry.was_at_graveyard = atoi(row[13]);
entry.is_locked = atoi(row[14]);
entry.exp = atoi(row[15]);
entry.size = atoi(row[16]);
entry.level = atoi(row[17]);
entry.race = atoi(row[18]);
entry.gender = atoi(row[19]);
entry.class = atoi(row[20]);
entry.deity = atoi(row[21]);
entry.texture = atoi(row[22]);
entry.helm_texture = atoi(row[23]);
entry.copper = atoi(row[24]);
entry.silver = atoi(row[25]);
entry.gold = atoi(row[26]);
entry.platinum = atoi(row[27]);
entry.hair_color = atoi(row[28]);
entry.beard_color = atoi(row[29]);
entry.eye_color_1 = atoi(row[30]);
entry.eye_color_2 = atoi(row[31]);
entry.hair_style = atoi(row[32]);
entry.face = atoi(row[33]);
entry.beard = atoi(row[34]);
entry.drakkin_heritage = atoi(row[35]);
entry.drakkin_tattoo = atoi(row[36]);
entry.drakkin_details = atoi(row[37]);
entry.wc_1 = atoi(row[38]);
entry.wc_2 = atoi(row[39]);
entry.wc_3 = atoi(row[40]);
entry.wc_4 = atoi(row[41]);
entry.wc_5 = atoi(row[42]);
entry.wc_6 = atoi(row[43]);
entry.wc_7 = atoi(row[44]);
entry.wc_8 = atoi(row[45]);
entry.wc_9 = atoi(row[46]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = database.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_CHARACTER_CORPSES_REPOSITORY_H
@@ -0,0 +1,455 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_CHARACTER_CURRENCY_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_CURRENCY_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterCurrencyRepository {
public:
struct CharacterCurrency {
int id;
int platinum;
int gold;
int silver;
int copper;
int platinum_bank;
int gold_bank;
int silver_bank;
int copper_bank;
int platinum_cursor;
int gold_cursor;
int silver_cursor;
int copper_cursor;
int radiant_crystals;
int career_radiant_crystals;
int ebon_crystals;
int career_ebon_crystals;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"platinum",
"gold",
"silver",
"copper",
"platinum_bank",
"gold_bank",
"silver_bank",
"copper_bank",
"platinum_cursor",
"gold_cursor",
"silver_cursor",
"copper_cursor",
"radiant_crystals",
"career_radiant_crystals",
"ebon_crystals",
"career_ebon_crystals",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string 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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static CharacterCurrency NewEntity()
{
CharacterCurrency entry{};
entry.id = 0;
entry.platinum = 0;
entry.gold = 0;
entry.silver = 0;
entry.copper = 0;
entry.platinum_bank = 0;
entry.gold_bank = 0;
entry.silver_bank = 0;
entry.copper_bank = 0;
entry.platinum_cursor = 0;
entry.gold_cursor = 0;
entry.silver_cursor = 0;
entry.copper_cursor = 0;
entry.radiant_crystals = 0;
entry.career_radiant_crystals = 0;
entry.ebon_crystals = 0;
entry.career_ebon_crystals = 0;
return entry;
}
static CharacterCurrency GetCharacterCurrencyEntry(
const std::vector<CharacterCurrency> &character_currencys,
int character_currency_id
)
{
for (auto &character_currency : character_currencys) {
if (character_currency.id == character_currency_id) {
return character_currency;
}
}
return NewEntity();
}
static CharacterCurrency FindOne(
int character_currency_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_currency_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterCurrency entry{};
entry.id = atoi(row[0]);
entry.platinum = atoi(row[1]);
entry.gold = atoi(row[2]);
entry.silver = atoi(row[3]);
entry.copper = atoi(row[4]);
entry.platinum_bank = atoi(row[5]);
entry.gold_bank = atoi(row[6]);
entry.silver_bank = atoi(row[7]);
entry.copper_bank = atoi(row[8]);
entry.platinum_cursor = atoi(row[9]);
entry.gold_cursor = atoi(row[10]);
entry.silver_cursor = atoi(row[11]);
entry.copper_cursor = atoi(row[12]);
entry.radiant_crystals = atoi(row[13]);
entry.career_radiant_crystals = atoi(row[14]);
entry.ebon_crystals = atoi(row[15]);
entry.career_ebon_crystals = atoi(row[16]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int character_currency_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_currency_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
CharacterCurrency character_currency_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(character_currency_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(character_currency_entry.platinum));
update_values.push_back(columns[2] + " = " + std::to_string(character_currency_entry.gold));
update_values.push_back(columns[3] + " = " + std::to_string(character_currency_entry.silver));
update_values.push_back(columns[4] + " = " + std::to_string(character_currency_entry.copper));
update_values.push_back(columns[5] + " = " + std::to_string(character_currency_entry.platinum_bank));
update_values.push_back(columns[6] + " = " + std::to_string(character_currency_entry.gold_bank));
update_values.push_back(columns[7] + " = " + std::to_string(character_currency_entry.silver_bank));
update_values.push_back(columns[8] + " = " + std::to_string(character_currency_entry.copper_bank));
update_values.push_back(columns[9] + " = " + std::to_string(character_currency_entry.platinum_cursor));
update_values.push_back(columns[10] + " = " + std::to_string(character_currency_entry.gold_cursor));
update_values.push_back(columns[11] + " = " + std::to_string(character_currency_entry.silver_cursor));
update_values.push_back(columns[12] + " = " + std::to_string(character_currency_entry.copper_cursor));
update_values.push_back(columns[13] + " = " + std::to_string(character_currency_entry.radiant_crystals));
update_values.push_back(columns[14] + " = " + std::to_string(character_currency_entry.career_radiant_crystals));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_currency_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterCurrency InsertOne(
CharacterCurrency character_currency_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_currency_entry.id));
insert_values.push_back(std::to_string(character_currency_entry.platinum));
insert_values.push_back(std::to_string(character_currency_entry.gold));
insert_values.push_back(std::to_string(character_currency_entry.silver));
insert_values.push_back(std::to_string(character_currency_entry.copper));
insert_values.push_back(std::to_string(character_currency_entry.platinum_bank));
insert_values.push_back(std::to_string(character_currency_entry.gold_bank));
insert_values.push_back(std::to_string(character_currency_entry.silver_bank));
insert_values.push_back(std::to_string(character_currency_entry.copper_bank));
insert_values.push_back(std::to_string(character_currency_entry.platinum_cursor));
insert_values.push_back(std::to_string(character_currency_entry.gold_cursor));
insert_values.push_back(std::to_string(character_currency_entry.silver_cursor));
insert_values.push_back(std::to_string(character_currency_entry.copper_cursor));
insert_values.push_back(std::to_string(character_currency_entry.radiant_crystals));
insert_values.push_back(std::to_string(character_currency_entry.career_radiant_crystals));
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_currency_entry.id = results.LastInsertedID();
return character_currency_entry;
}
character_currency_entry = NewEntity();
return character_currency_entry;
}
static int InsertMany(
std::vector<CharacterCurrency> character_currency_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_currency_entry: character_currency_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_currency_entry.id));
insert_values.push_back(std::to_string(character_currency_entry.platinum));
insert_values.push_back(std::to_string(character_currency_entry.gold));
insert_values.push_back(std::to_string(character_currency_entry.silver));
insert_values.push_back(std::to_string(character_currency_entry.copper));
insert_values.push_back(std::to_string(character_currency_entry.platinum_bank));
insert_values.push_back(std::to_string(character_currency_entry.gold_bank));
insert_values.push_back(std::to_string(character_currency_entry.silver_bank));
insert_values.push_back(std::to_string(character_currency_entry.copper_bank));
insert_values.push_back(std::to_string(character_currency_entry.platinum_cursor));
insert_values.push_back(std::to_string(character_currency_entry.gold_cursor));
insert_values.push_back(std::to_string(character_currency_entry.silver_cursor));
insert_values.push_back(std::to_string(character_currency_entry.copper_cursor));
insert_values.push_back(std::to_string(character_currency_entry.radiant_crystals));
insert_values.push_back(std::to_string(character_currency_entry.career_radiant_crystals));
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));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterCurrency> All()
{
std::vector<CharacterCurrency> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterCurrency entry{};
entry.id = atoi(row[0]);
entry.platinum = atoi(row[1]);
entry.gold = atoi(row[2]);
entry.silver = atoi(row[3]);
entry.copper = atoi(row[4]);
entry.platinum_bank = atoi(row[5]);
entry.gold_bank = atoi(row[6]);
entry.silver_bank = atoi(row[7]);
entry.copper_bank = atoi(row[8]);
entry.platinum_cursor = atoi(row[9]);
entry.gold_cursor = atoi(row[10]);
entry.silver_cursor = atoi(row[11]);
entry.copper_cursor = atoi(row[12]);
entry.radiant_crystals = atoi(row[13]);
entry.career_radiant_crystals = atoi(row[14]);
entry.ebon_crystals = atoi(row[15]);
entry.career_ebon_crystals = atoi(row[16]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterCurrency> GetWhere(std::string where_filter)
{
std::vector<CharacterCurrency> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterCurrency entry{};
entry.id = atoi(row[0]);
entry.platinum = atoi(row[1]);
entry.gold = atoi(row[2]);
entry.silver = atoi(row[3]);
entry.copper = atoi(row[4]);
entry.platinum_bank = atoi(row[5]);
entry.gold_bank = atoi(row[6]);
entry.silver_bank = atoi(row[7]);
entry.copper_bank = atoi(row[8]);
entry.platinum_cursor = atoi(row[9]);
entry.gold_cursor = atoi(row[10]);
entry.silver_cursor = atoi(row[11]);
entry.copper_cursor = atoi(row[12]);
entry.radiant_crystals = atoi(row[13]);
entry.career_radiant_crystals = atoi(row[14]);
entry.ebon_crystals = atoi(row[15]);
entry.career_ebon_crystals = atoi(row[16]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = database.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_CHARACTER_CURRENCY_REPOSITORY_H
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,329 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_CHARACTER_DISCIPLINES_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_DISCIPLINES_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterDisciplinesRepository {
public:
struct CharacterDisciplines {
int id;
int slot_id;
int disc_id;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"slot_id",
"disc_id",
};
}
static std::string ColumnsRaw()
{
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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static CharacterDisciplines NewEntity()
{
CharacterDisciplines entry{};
entry.id = 0;
entry.slot_id = 0;
entry.disc_id = 0;
return entry;
}
static CharacterDisciplines GetCharacterDisciplinesEntry(
const std::vector<CharacterDisciplines> &character_discipliness,
int character_disciplines_id
)
{
for (auto &character_disciplines : character_discipliness) {
if (character_disciplines.id == character_disciplines_id) {
return character_disciplines;
}
}
return NewEntity();
}
static CharacterDisciplines FindOne(
int character_disciplines_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_disciplines_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterDisciplines entry{};
entry.id = atoi(row[0]);
entry.slot_id = atoi(row[1]);
entry.disc_id = atoi(row[2]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int character_disciplines_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_disciplines_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
CharacterDisciplines character_disciplines_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(character_disciplines_entry.id));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_disciplines_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterDisciplines InsertOne(
CharacterDisciplines character_disciplines_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_disciplines_entry.id));
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_disciplines_entry.id = results.LastInsertedID();
return character_disciplines_entry;
}
character_disciplines_entry = NewEntity();
return character_disciplines_entry;
}
static int InsertMany(
std::vector<CharacterDisciplines> character_disciplines_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_disciplines_entry: character_disciplines_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_disciplines_entry.id));
insert_values.push_back(std::to_string(character_disciplines_entry.slot_id));
insert_values.push_back(std::to_string(character_disciplines_entry.disc_id));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterDisciplines> All()
{
std::vector<CharacterDisciplines> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterDisciplines entry{};
entry.id = atoi(row[0]);
entry.slot_id = atoi(row[1]);
entry.disc_id = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterDisciplines> GetWhere(std::string where_filter)
{
std::vector<CharacterDisciplines> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterDisciplines entry{};
entry.id = atoi(row[0]);
entry.slot_id = atoi(row[1]);
entry.disc_id = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = database.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_CHARACTER_DISCIPLINES_REPOSITORY_H
@@ -0,0 +1,320 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_CHARACTER_INSPECT_MESSAGES_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_INSPECT_MESSAGES_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterInspectMessagesRepository {
public:
struct CharacterInspectMessages {
int id;
std::string inspect_message;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"inspect_message",
};
}
static std::string ColumnsRaw()
{
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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static CharacterInspectMessages NewEntity()
{
CharacterInspectMessages entry{};
entry.id = 0;
entry.inspect_message = "";
return entry;
}
static CharacterInspectMessages GetCharacterInspectMessagesEntry(
const std::vector<CharacterInspectMessages> &character_inspect_messagess,
int character_inspect_messages_id
)
{
for (auto &character_inspect_messages : character_inspect_messagess) {
if (character_inspect_messages.id == character_inspect_messages_id) {
return character_inspect_messages;
}
}
return NewEntity();
}
static CharacterInspectMessages FindOne(
int character_inspect_messages_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_inspect_messages_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterInspectMessages entry{};
entry.id = atoi(row[0]);
entry.inspect_message = row[1] ? row[1] : "";
return entry;
}
return NewEntity();
}
static int DeleteOne(
int character_inspect_messages_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_inspect_messages_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
CharacterInspectMessages character_inspect_messages_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_inspect_messages_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterInspectMessages InsertOne(
CharacterInspectMessages character_inspect_messages_entry
)
{
std::vector<std::string> insert_values;
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_inspect_messages_entry.id = results.LastInsertedID();
return character_inspect_messages_entry;
}
character_inspect_messages_entry = NewEntity();
return character_inspect_messages_entry;
}
static int InsertMany(
std::vector<CharacterInspectMessages> character_inspect_messages_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_inspect_messages_entry: character_inspect_messages_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_inspect_messages_entry.id));
insert_values.push_back("'" + EscapeString(character_inspect_messages_entry.inspect_message) + "'");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterInspectMessages> All()
{
std::vector<CharacterInspectMessages> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterInspectMessages entry{};
entry.id = atoi(row[0]);
entry.inspect_message = row[1] ? row[1] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterInspectMessages> GetWhere(std::string where_filter)
{
std::vector<CharacterInspectMessages> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterInspectMessages entry{};
entry.id = atoi(row[0]);
entry.inspect_message = row[1] ? row[1] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = database.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_CHARACTER_INSPECT_MESSAGES_REPOSITORY_H
@@ -0,0 +1,329 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*
*/
/**
* 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
*/
#ifndef EQEMU_BASE_CHARACTER_ITEM_RECAST_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_ITEM_RECAST_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterItemRecastRepository {
public:
struct CharacterItemRecast {
int id;
int recast_type;
int timestamp;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"recast_type",
"timestamp",
};
}
static std::string ColumnsRaw()
{
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");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static CharacterItemRecast NewEntity()
{
CharacterItemRecast entry{};
entry.id = 0;
entry.recast_type = 0;
entry.timestamp = 0;
return entry;
}
static CharacterItemRecast GetCharacterItemRecastEntry(
const std::vector<CharacterItemRecast> &character_item_recasts,
int character_item_recast_id
)
{
for (auto &character_item_recast : character_item_recasts) {
if (character_item_recast.id == character_item_recast_id) {
return character_item_recast;
}
}
return NewEntity();
}
static CharacterItemRecast FindOne(
int character_item_recast_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_item_recast_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterItemRecast entry{};
entry.id = atoi(row[0]);
entry.recast_type = atoi(row[1]);
entry.timestamp = atoi(row[2]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int character_item_recast_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_item_recast_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
CharacterItemRecast character_item_recast_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(character_item_recast_entry.id));
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(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_item_recast_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterItemRecast InsertOne(
CharacterItemRecast character_item_recast_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_item_recast_entry.id));
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(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_item_recast_entry.id = results.LastInsertedID();
return character_item_recast_entry;
}
character_item_recast_entry = NewEntity();
return character_item_recast_entry;
}
static int InsertMany(
std::vector<CharacterItemRecast> character_item_recast_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_item_recast_entry: character_item_recast_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_item_recast_entry.id));
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));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterItemRecast> All()
{
std::vector<CharacterItemRecast> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterItemRecast entry{};
entry.id = atoi(row[0]);
entry.recast_type = atoi(row[1]);
entry.timestamp = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterItemRecast> GetWhere(std::string where_filter)
{
std::vector<CharacterItemRecast> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterItemRecast entry{};
entry.id = atoi(row[0]);
entry.recast_type = atoi(row[1]);
entry.timestamp = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(std::string where_filter)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate()
{
auto results = database.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_CHARACTER_ITEM_RECAST_REPOSITORY_H

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