AccountServer: Difference between revisions

From OuroDev
No edit summary
Danda (talk | contribs)
 
(2 intermediate revisions by 2 users not shown)
Line 1: Line 1:
AccountServer handles all inventory-related queries and reads processed payment information. PlaySpan is the original payment backend used before NCSoft shut down City of Heroes.
AccountServer handles all inventory-related queries and reads processed payment information. PlaySpan is the original payment backend used before NCSoft shut down City of Heroes.
AccountServer is also responsible for directing the transfer of player characters (Entities) between shards.


== Configuration ==
== Configuration ==
Line 24: Line 26:


== Database Schema ==
== Database Schema ==
An SQL dump will be bundled with future releases of code. Until then, [https://drive.google.com/open?id=1aYQYH3cr82z895ieuZPP2YPwVw7Y0oPP here you go].
An SQL dump can be found under Source\Assets\DbSchemas.


== Table Structures ==
== Table Structures ==
Line 30: Line 32:


=== account ===
=== account ===
{| style="border: 1px solid #a2a9b1; text-align: center"
{| class="wikitable"
||
! Column Name
<table>
! Data Type
<tr>
! Attributes
<th>
|-
Column Name
| auth_id
</th>
| int
<th>
| Primary Key
Data Type
|-
</th>
| name
<th>
| varchar(14)
Attributes
|
</th>
|-
</tr>
| loyalty_bits
<tr>
| binary(16)
<td>
|
auth_id
|-
</td>
| last_loyalty_point_count
<td>
| smallint
int
|
</td>
|-
<td>
| loyalty_points_spent
Primary Key
| smallint
</td>
|
</tr>
|-
<tr>
| last_email_date
<td>
| smalldatetime
name
|
</td>
|-
<td>
| last_num_emails_sent
varchar(14)
| smallint
</td>
|
</tr>
|-
<tr>
| free_xfer_date
<td>
| smalldatetime
loyalty_bits
|
</td>
<td>
binary(16)
</td>
</tr>
<tr>
<td>
last_loyalty_point_count
</td>
<td>
smallint
</td>
</tr>
<tr>
<td>
loyalty_points_spent
</td>
<td>
smallint
</td>
</tr>
<tr>
<td>
last_email_date
</td>
<td>
smalldatetime
</td>
</tr>
<tr>
<td>
last_num_emails_sent
</td>
<td>
smallint
</td>
</tr>
<tr>
<td>
free_xfer_date
</td>
<td>
smalldatetime
</td>
</tr>
</table>
|}
|}


=== game_log ===
=== game_log ===
{| style="border: 1px solid #a2a9b1; text-align: center"
{| class="wikitable"
||
! Column Name
<table>
! Data Type
<tr>
! Attributes
<th>
|-
Column Name
| order_id
</th>
| uniqueidentifier
<th>
| Primary Key, Foreign Key to game_transactions.order_id
Data Type
|-
</th>
| auth_id
<th>
| int
Attributes
| Foreign Key to account.auth_id, Not Nullable
</th>
|-
</tr>
| sku_id
<tr>
| char(8)
<td>
| Foreign Key to product.sku_id, Not Nullable
order_id
|-
</td>
| transaction_date
<td>
| datetime
uniqueidentifier
|
</td>
|-
<td>
| shard_id
Primary Key, Foreign Key to game_transactions.order_id
| tinyint
</td>
|
</tr>
|-
<tr>
| ent_id
<td>
| int
auth_id
|
</td>
|-
<td>
| granted
int
| int
</td>
|
<td>
|-
Foreign Key to account.auth_id, Not Nullable
| claimed
</td>
| int
</tr>
|
<tr>
|-
<td>
| csr_did_it
sku_id
| bit
</td>
|
<td>
|-
char(8)
| parent_order_id
</td>
| uniqueidentifier
<td>
| Foreign Key to game_transactions.order_id, Not Nullable
Foreign Key to product.sku_id, Not Nullable
|-
</td>
| saved
</tr>
| int
<tr>
|
<td>
transaction_date
</td>
<td>
datetime
</td>
</tr>
<tr>
<td>
shard_id
</td>
<td>
tinyint
</td>
</tr>
<tr>
<td>
ent_id
</td>
<td>
int
</td>
</tr>
<tr>
<td>
granted
</td>
<td>
int
</td>
</tr>
<tr>
<td>
claimed
</td>
<td>
int
</td>
</tr>
<tr>
<td>
csr_did_it
</td>
<td>
bit
</td>
</tr>
<tr>
<td>
parent_order_id
</td>
<td>
uniqueidentifier
</td>
<td>
Foreign Key to game_transactions.order_id, Not Nullable
</td>
</tr>
<tr>
<td>
saved
</td>
<td>
int
</td>
</tr>
</table>
|}
|}


=== game_transactions ===
=== game_transactions ===
{| style="border: 1px solid #a2a9b1; text-align: center"
{| class="wikitable"
||
! Column Name
<table>
! Data Type
<tr>
! Attributes
<th>
|-
Column Name
| order_id
</th>
| uniqueidentifier
<th>
| Primary Key
Data Type
|-
</th>
| auth_id
<th>
| int
Attributes
| Foreign Key to account.auth_id, Not Nullable
</th>
|-
</tr>
| sku_id
<tr>
| char(8)
<td>
| Foreign Key to product.sku_id, Not Nullable
order_id
|-
</td>
| transaction_date
<td>
| datetime
uniqueidentifier
|
</td>
|-
<td>
| shard_id
Primary Key
| tinyint
</td>
|
</tr>
|-
<tr>
| ent_id
<td>
| int
auth_id
|
</td>
|-
<td>
| granted
int
| int
</td>
|
<td>
|-
Foreign Key to account.auth_id, Not Nullable
| claimed
</td>
| int
</tr>
|
<tr>
|-
<td>
| csr_did_it
sku_id
| bit
</td>
|
<td>
|-
char(8)
| parent_order_id
</td>
| uniqueidentifier
<td>
| Foreign Key to game_transactions.order_id, Not Nullable
Foreign Key to product.sku_id, Not Nullable
</tr>
<tr>
<td>
transaction_date
</td>
<td>
datetime
</td>
</tr>
<tr>
<td>
shard_id
</td>
<td>
tinyint
</td>
</tr>
<tr>
<td>
ent_id
</td>
<td>
int
</td>
</tr>
<tr>
<td>
granted
</td>
<td>
int
</td>
</tr>
<tr>
<td>
claimed
</td>
<td>
int
</td>
</tr>
<tr>
<td>
csr_did_it
</td>
<td>
bit
</td>
</tr>
<tr>
<td>
parent_order_id
</td>
<td>
uniqueidentifier
</td>
<td>
Foreign Key to game_transactions.order_id, Not Nullable
</td>
</tr>
</table>
|}
|}


=== inventory ===
=== inventory ===
{| style="border: 1px solid #a2a9b1; text-align: center"
{| class="wikitable"
||
! Column Name
<table>
! Data Type
<tr>
! Attributes
<th>
|-
Column Name
| auth_id
</th>
| int
<th>
| Foreign Key to account.auth_id, Not Nullable
Data Type
|-
</th>
| sku_id
<th>
| char(8)
Attributes
| Foreign Key to product.sku_id, Not Nullable
</th>
|-
</tr>
| granted_total
<tr>
| int
<td>
|
auth_id
|-
</td>
| claimed_total
<td>
| int
int
|
</td>
|-
<td>
| saved_total
Foreign Key to account.auth_id, Not Nullable
| int
</td>
|
</tr>
|-
<tr>
| expires
<td>
| smalldatetime
sku_id
|
</td>
<td>
char(8)
</td>
<td>
Foreign Key to product.sku_id, Not Nullable
</td>
</tr>
<tr>
<td>
granted_total
</td>
<td>
int
</td>
</tr>
<tr>
<td>
claimed_total
</td>
<td>
int
</td>
</tr>
<tr>
<td>
saved_total
</td>
<td>
int
</td>
</tr>
<tr>
<td>
expires
</td>
<td>
smalldatetime
</td>
</tr>
</table>
|}
|}


=== mtx_log ===
=== mtx_log ===
{| style="border: 1px solid #a2a9b1; text-align: center"
{| class="wikitable"
||
! Column Name
<table>
! Data Type
<tr>
! Attributes
<th>
|-
Column Name
| order_id
</th>
| uniqueidentifier
<th>
| Primary Key, Foreign Key to game_transactions.order_id
Data Type
|-
</th>
| auth_id
<th>
| int
Attributes
| Foreign Key to account.auth_id, Not Nullable
</th>
|-
</tr>
| sku_id
<tr>
| char(8)
<td>
| Foreign Key to product.sku_id, Not Nullable
order_id
|-
</td>
| transaction_date
<td>
| datetime
int
|
</td>
|-
<td>
| quantity
Primary Key, Foreign Key to game_transactions.order_id
| int
</td>
|
</tr>
|-
<tr>
| points
<td>
| int
auth_id
|
</td>
<td>
int
</td>
<td>
Foreign Key to account.auth_id, Not Nullable
</td>
</tr>
<tr>
<td>
sku_id
</td>
<td>
char(8)
</td>
<td>
Foreign Key to product.sku_id, Not Nullable
</td>
</tr>
<tr>
<td>
transaction_date
</td>
<td>
datetime
</td>
</tr>
<tr>
<td>
quantity
</td>
<td>
int
</td>
</tr>
<tr>
<td>
points
</td>
<td>
int
</td>
</tr>
</table>
|}
|}


=== product ===
=== product ===
{| style="border: 1px solid #a2a9b1; text-align: center"
{| class="wikitable"
||
! Column Name
<table>
! Data Type
<tr>
! Attributes
<th>
|-
Column Name
| sku_id
</th>
| char(8)
<th>
| Primary Key
Data Type
|-
</th>
| name
<th>
| varchar(128)
Attributes
|
</th>
|-
</tr>
| product_type_id
<tr>
| int
<td>
| Foreign Key to product_type.product_type_id, Not Nullable
sku_id
|-
</td>
| grant_limit
<td>
| int
varchar(8)
|
</td>
|-
<td>
| expiration_seconds
Primary Key
| int
</td>
|
</tr>
<tr>
<td>
name
</td>
<td>
varchar(128)
</td>
</tr>
<tr>
<td>
product_type_id
</td>
<td>
int
</td>
<td>
Foreign Key to product_type.product_type_id, Not Nullable
</td>
</tr>
<tr>
<td>
grant_limit
</td>
<td>
int
</td>
</tr>
<tr>
<td>
expiration_seconds
</td>
<td>
int
</td>
</tr>
</table>
|}
|}


=== product_type ===
=== product_type ===
{| style="border: 1px solid #a2a9b1; text-align: center"
{| class="wikitable"
||
! Column Name
<table>
! Data Type
<tr>
! Attributes
<th>
|-
Column Name
| product_type_id
</th>
| int
<th>
| Primary Key
Data Type
|-
</th>
| name
<th>
| varchar(128)
Attributes
| Not Nullable
</th>
</tr>
<tr>
<td>
product_type_id
</td>
<td>
int
</td>
<td>
Primary Key
</td>
</tr>
<tr>
<td>
name
</td>
<td>
varchar(128)
</td>
<td>
Not Nullable
</td>
</tr>
</table>
|}
|}



Latest revision as of 19:14, 25 May 2019

AccountServer handles all inventory-related queries and reads processed payment information. PlaySpan is the original payment backend used before NCSoft shut down City of Heroes.

AccountServer is also responsible for directing the transfer of player characters (Entities) between shards.

Configuration

account_server.cfg

ShardName
  ShardName Paragon
  ShardId 1
  Address 127.0.0.1
  NoXferOut
  NoXferIn
  XferDestinations None
ShardEnd
PlayNCAdminWebPageSecretKey Paragon
MtxEnvironment Paragon
MtxSecretKey Paragon
MtxIOThreads 1
SqlDbName cohacc
SqlLogin "Driver={SQL Server Native Client 11.0};server=localhost;database=cohacc;trusted_connection=Yes;"
CatalogTimeStampTestOffsetDays 0
clientAuthTimeout 1800
ShardXfersDayMemory 14
ShardXfersAllowedInMemory 0

Database Schema

An SQL dump can be found under Source\Assets\DbSchemas.

Table Structures

Columns are nullable unless denoted by Primary Key or Non Nullable.

account

Column Name Data Type Attributes
auth_id int Primary Key
name varchar(14)
loyalty_bits binary(16)
last_loyalty_point_count smallint
loyalty_points_spent smallint
last_email_date smalldatetime
last_num_emails_sent smallint
free_xfer_date smalldatetime

game_log

Column Name Data Type Attributes
order_id uniqueidentifier Primary Key, Foreign Key to game_transactions.order_id
auth_id int Foreign Key to account.auth_id, Not Nullable
sku_id char(8) Foreign Key to product.sku_id, Not Nullable
transaction_date datetime
shard_id tinyint
ent_id int
granted int
claimed int
csr_did_it bit
parent_order_id uniqueidentifier Foreign Key to game_transactions.order_id, Not Nullable
saved int

game_transactions

Column Name Data Type Attributes
order_id uniqueidentifier Primary Key
auth_id int Foreign Key to account.auth_id, Not Nullable
sku_id char(8) Foreign Key to product.sku_id, Not Nullable
transaction_date datetime
shard_id tinyint
ent_id int
granted int
claimed int
csr_did_it bit
parent_order_id uniqueidentifier Foreign Key to game_transactions.order_id, Not Nullable

inventory

Column Name Data Type Attributes
auth_id int Foreign Key to account.auth_id, Not Nullable
sku_id char(8) Foreign Key to product.sku_id, Not Nullable
granted_total int
claimed_total int
saved_total int
expires smalldatetime

mtx_log

Column Name Data Type Attributes
order_id uniqueidentifier Primary Key, Foreign Key to game_transactions.order_id
auth_id int Foreign Key to account.auth_id, Not Nullable
sku_id char(8) Foreign Key to product.sku_id, Not Nullable
transaction_date datetime
quantity int
points int

product

Column Name Data Type Attributes
sku_id char(8) Primary Key
name varchar(128)
product_type_id int Foreign Key to product_type.product_type_id, Not Nullable
grant_limit int
expiration_seconds int

product_type

Column Name Data Type Attributes
product_type_id int Primary Key
name varchar(128) Not Nullable

Stored Procedures

SP_add_game_transaction

SP_add_micro_transaction

SP_add_multi_game_transaction

SP_find_or_create_account

SP_read_unsaved_game_transactions

SP_revert_game_transaction

SP_save_game_transaction

SP_update_account

Table-Valued Parameters

TVP_game_transaction

Development Notes

[2:14 PM] Searge: nice, you can also get all sku by just changing some code, int AccountGetStoreProductCount2(AccountInventorySet* invSet, const AccountProduct* pProd, bool bActive) in AccountData.c could always return 1
[2:39 PM] Searge: @Pazaz the loyalty bits set by the client when you take all of them are set to 0xFFFFFFFF7FE00F000000000000000000 in the database