database sql files

This commit is contained in:
Benjamin Palko 2024-10-03 20:31:22 -04:00
parent 56f41276ed
commit cf0a134784
7 changed files with 221623 additions and 0 deletions

415
db/GMRustyHearts.sql Normal file
View file

@ -0,0 +1,415 @@
/*
Navicat Premium Data Transfer
Source Server : RH VM
Source Server Type : SQL Server
Source Server Version : 16001105
Source Host : 192.168.100.202:1433
Source Catalog : GMRustyHearts
Source Schema : dbo
Target Server Type : SQL Server
Target Server Version : 16001105
File Encoding : 65001
Date: 12/12/2023 01:43:52
*/
-- ----------------------------
-- Table structure for Admin_Sys_Param
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[Admin_Sys_Param]') AND type IN ('U'))
DROP TABLE [dbo].[Admin_Sys_Param]
GO
CREATE TABLE [dbo].[Admin_Sys_Param] (
[seq] int IDENTITY(1,1) NOT NULL,
[param_name] nvarchar(50) COLLATE Korean_Wansung_CI_AS NOT NULL,
[param_value] nvarchar(255) COLLATE Korean_Wansung_CI_AS NOT NULL,
[remark1] nvarchar(50) COLLATE Korean_Wansung_CI_AS NOT NULL,
[remark2] nvarchar(50) COLLATE Korean_Wansung_CI_AS NOT NULL,
[read_yn] int NULL,
[regdate] datetime NOT NULL
)
GO
ALTER TABLE [dbo].[Admin_Sys_Param] SET (LOCK_ESCALATION = TABLE)
GO
-- ----------------------------
-- Records of Admin_Sys_Param
-- ----------------------------
SET IDENTITY_INSERT [dbo].[Admin_Sys_Param] ON
GO
SET IDENTITY_INSERT [dbo].[Admin_Sys_Param] OFF
GO
-- ----------------------------
-- Table structure for AdminRoles
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[AdminRoles]') AND type IN ('U'))
DROP TABLE [dbo].[AdminRoles]
GO
CREATE TABLE [dbo].[AdminRoles] (
[Idx] int IDENTITY(1,1) NOT NULL,
[AdminID] nvarchar(50) COLLATE Korean_Wansung_CI_AS NOT NULL,
[AdminPW] nvarchar(50) COLLATE Korean_Wansung_CI_AS NOT NULL,
[AdminRoles] nvarchar(50) COLLATE Korean_Wansung_CI_AS NOT NULL,
[RegDate] datetime DEFAULT getdate() NOT NULL,
[RegName] nvarchar(50) COLLATE Korean_Wansung_CI_AS NULL,
[AdminYN] nchar(2) COLLATE Korean_Wansung_CI_AS DEFAULT N'N' NULL,
[accessControlYN] nvarchar(2) COLLATE Korean_Wansung_CI_AS DEFAULT 'N' NULL,
[ip_1] nvarchar(50) COLLATE Korean_Wansung_CI_AS DEFAULT '' NULL,
[ip_2] nvarchar(50) COLLATE Korean_Wansung_CI_AS DEFAULT '' NULL,
[ip_3] nvarchar(50) COLLATE Korean_Wansung_CI_AS DEFAULT '' NULL
)
GO
ALTER TABLE [dbo].[AdminRoles] SET (LOCK_ESCALATION = TABLE)
GO
-- ----------------------------
-- Records of AdminRoles
-- ----------------------------
SET IDENTITY_INSERT [dbo].[AdminRoles] ON
GO
INSERT INTO [dbo].[AdminRoles] ([Idx], [AdminID], [AdminPW], [AdminRoles], [RegDate], [RegName], [AdminYN], [accessControlYN], [ip_1], [ip_2], [ip_3]) VALUES (N'16', N'admin', N'admin', N'1', N'2022-06-24 07:27:34.730', N'admin', N' Y', N'N', N'', N'', N'')
GO
SET IDENTITY_INSERT [dbo].[AdminRoles] OFF
GO
-- ----------------------------
-- Table structure for GMAudit
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[GMAudit]') AND type IN ('U'))
DROP TABLE [dbo].[GMAudit]
GO
CREATE TABLE [dbo].[GMAudit] (
[audit_id] uniqueidentifier DEFAULT newid() NOT NULL,
[AdminID] nvarchar(50) COLLATE Korean_Wansung_CI_AS NOT NULL,
[world_index] int NOT NULL,
[bcust_id] nvarchar(50) COLLATE Korean_Wansung_CI_AS DEFAULT N'None' NULL,
[character_id] nvarchar(50) COLLATE Korean_Wansung_CI_AS NULL,
[char_name] nvarchar(50) COLLATE Korean_Wansung_CI_AS NULL,
[Type] nvarchar(100) COLLATE Korean_Wansung_CI_AS NOT NULL,
[Modify] nvarchar(1500) COLLATE Korean_Wansung_CI_AS NULL,
[Memo] nvarchar(200) COLLATE Korean_Wansung_CI_AS NOT NULL,
[date] datetime DEFAULT getdate() NOT NULL
)
GO
ALTER TABLE [dbo].[GMAudit] SET (LOCK_ESCALATION = TABLE)
GO
-- ----------------------------
-- Records of GMAudit
-- ----------------------------
-- ----------------------------
-- Table structure for GMInfoTable
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[GMInfoTable]') AND type IN ('U'))
DROP TABLE [dbo].[GMInfoTable]
GO
CREATE TABLE [dbo].[GMInfoTable] (
[gm_id] int NOT NULL,
[name] nvarchar(16) COLLATE Korean_Wansung_CI_AS NOT NULL,
[pass] nvarchar(16) COLLATE Korean_Wansung_CI_AS NOT NULL,
[permission] int NOT NULL,
[logout_time] datetime NOT NULL
)
GO
ALTER TABLE [dbo].[GMInfoTable] SET (LOCK_ESCALATION = TABLE)
GO
-- ----------------------------
-- Records of GMInfoTable
-- ----------------------------
INSERT INTO [dbo].[GMInfoTable] ([gm_id], [name], [pass], [permission], [logout_time]) VALUES (N'1', N'admin', N'admin', N'1', N'2022-03-02 22:20:41.000')
GO
-- ----------------------------
-- Table structure for GMLoginLog
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[GMLoginLog]') AND type IN ('U'))
DROP TABLE [dbo].[GMLoginLog]
GO
CREATE TABLE [dbo].[GMLoginLog] (
[Idx] bigint IDENTITY(1,1) NOT NULL,
[AdminID] nvarchar(50) COLLATE Korean_Wansung_CI_AS NOT NULL,
[RegName] nvarchar(50) COLLATE Korean_Wansung_CI_AS NULL,
[accessIP] nvarchar(50) COLLATE Korean_Wansung_CI_AS NULL,
[successYN] nvarchar(50) COLLATE Korean_Wansung_CI_AS NULL,
[LogDate] datetime DEFAULT getdate() NOT NULL,
[type] nvarchar(50) COLLATE Korean_Wansung_CI_AS DEFAULT ' ' NOT NULL
)
GO
ALTER TABLE [dbo].[GMLoginLog] SET (LOCK_ESCALATION = TABLE)
GO
-- ----------------------------
-- Records of GMLoginLog
-- ----------------------------
SET IDENTITY_INSERT [dbo].[GMLoginLog] ON
GO
SET IDENTITY_INSERT [dbo].[GMLoginLog] OFF
GO
-- ----------------------------
-- Table structure for POPUP
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[POPUP]') AND type IN ('U'))
DROP TABLE [dbo].[POPUP]
GO
CREATE TABLE [dbo].[POPUP] (
[idx] int IDENTITY(1,1) NOT NULL,
[title] nvarchar(255) COLLATE Korean_Wansung_CI_AS NULL,
[width] int NULL,
[height] int NULL,
[v_width] int NULL,
[v_height] int NULL,
[memo] text COLLATE Korean_Wansung_CI_AS NULL,
[apply] nchar(2) COLLATE Korean_Wansung_CI_AS NULL,
[wdate] datetime NULL
)
GO
ALTER TABLE [dbo].[POPUP] SET (LOCK_ESCALATION = TABLE)
GO
-- ----------------------------
-- Records of POPUP
-- ----------------------------
SET IDENTITY_INSERT [dbo].[POPUP] ON
GO
SET IDENTITY_INSERT [dbo].[POPUP] OFF
GO
-- ----------------------------
-- Table structure for WorldList
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[WorldList]') AND type IN ('U'))
DROP TABLE [dbo].[WorldList]
GO
CREATE TABLE [dbo].[WorldList] (
[world_id] tinyint NOT NULL,
[world_name] nvarchar(50) COLLATE Korean_Wansung_CI_AS NOT NULL,
[db_id] nvarchar(50) COLLATE Korean_Wansung_CI_AS DEFAULT '' NULL,
[db_pw] nvarchar(50) COLLATE Korean_Wansung_CI_AS DEFAULT '' NULL,
[db_catalog] nvarchar(50) COLLATE Korean_Wansung_CI_AS DEFAULT '' NULL,
[db_ip] nvarchar(50) COLLATE Korean_Wansung_CI_AS DEFAULT '' NULL
)
GO
ALTER TABLE [dbo].[WorldList] SET (LOCK_ESCALATION = TABLE)
GO
-- ----------------------------
-- Records of WorldList
-- ----------------------------
INSERT INTO [dbo].[WorldList] ([world_id], [world_name], [db_id], [db_pw], [db_catalog], [db_ip]) VALUES (N'1', N'Ragezone', N'sa', N'RustyHearts', N'RustyHearts_Auth', N'127.0.0.1')
GO
-- ----------------------------
-- Table structure for X_6217
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[X_6217]') AND type IN ('U'))
DROP TABLE [dbo].[X_6217]
GO
CREATE TABLE [dbo].[X_6217] (
[id] int IDENTITY(1,1) NOT NULL,
[ResultTxt] nvarchar(4000) COLLATE Korean_Wansung_CI_AS NULL
)
GO
ALTER TABLE [dbo].[X_6217] SET (LOCK_ESCALATION = TABLE)
GO
-- ----------------------------
-- Records of X_6217
-- ----------------------------
SET IDENTITY_INSERT [dbo].[X_6217] ON
GO
SET IDENTITY_INSERT [dbo].[X_6217] OFF
GO
-- ----------------------------
-- procedure structure for CreateCalendar
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[CreateCalendar]') AND type IN ('P', 'PC', 'RF', 'X'))
DROP PROCEDURE[dbo].[CreateCalendar]
GO
CREATE PROCEDURE [dbo].[CreateCalendar]
/************************************************************************************************************
Purpose:
Given a start date and an end date, create a calendar of dates that easily traverses months and years. Is
capable of generating up to 179 years worth of calendar by month in any given run.
Usage Notes:
1. End date parameter is optional... if not provided, the start date will be used to return that one month.
2. Of the two input paramters, the lowest (earliest) date will be used as the start date regardless of the
order provided.
3. Returns a single result set containing all dates.
4. Does NOT use a Cursor, While Loop, Temp Table, or Table variable so that even really picky DBA's won't
reject the code.
5. Because only set-based code was used, returns 10 years worth of calendar in about 230 milliseconds.
A full year takes a scant 76 milliseconds and a single month takes 63 milliseconds. A hundred-year
calendar takes only 6.3 seconds.
6. The start date does NOT need to be the first of the month and the end date does NOT need to be the last
day of the month. The internal calculations will "auto-magically" include the whole month for both the
start and end dates as well as all months in between.
Revision History:
Rev 00 - 08/13/2007 - Jeff Moden - Initial creation and unit test.
************************************************************************************************************/
--===== Declare the input parameters
@pStartDate DATETIME, --Any date (can include time) in the desired start month
@pEndDate DATETIME = @pStartDate --Any date (can include time) in the desired end month
AS
--===== Create the correct environment
SET NOCOUNT ON --Suppress the auto-display of rowcounts to prevent false echos on GUI's
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED --Same as putting WITH (NOLOCK) on tables in query
--===== Create the base date that all the calculations rely on (is a Monday)
DECLARE @BaseDate DATETIME
SET @BaseDate = '1753-01-01'
--===== Make sure the inputs are in the correct order (start date must always be the earliest date)
IF @pEndDate < @pStartDate
BEGIN
DECLARE @Swap DATETIME
SELECT @Swap = @pStartDate,
@pStartDate = @pEndDate,
@pEndDate = @Swap
END
--===== Modify the start to start on the first of the same month and the end date to end on the last day
-- of the same month.
SET @pStartDate = DATEADD(mm,DATEDIFF(mm,@BaseDate,@pStartDate),@BaseDate)
SET @pEndDate = DATEADD(mm,DATEDIFF(mm,@BaseDate,@pEndDate)+1,@BaseDate)-1
--===== Create the calendar without loops, cursors, or temp tables
SELECT MAX(DATENAME(yy,d.TheDate)) AS [Year],
MAX(LEFT(DATENAME(mm,d.TheDate),3))AS [Month],
MAX(CASE WHEN DATENAME(dw,d.TheDate) = '월요일' THEN DATENAME(dd,d.TheDate) ELSE '' END) AS Mon,
MAX(CASE WHEN DATENAME(dw,d.TheDate) = '화요일' THEN DATENAME(dd,d.TheDate) ELSE '' END) AS Tue,
MAX(CASE WHEN DATENAME(dw,d.TheDate) = '수요일' THEN DATENAME(dd,d.TheDate) ELSE '' END) AS Wed,
MAX(CASE WHEN DATENAME(dw,d.TheDate) = '목요일' THEN DATENAME(dd,d.TheDate) ELSE '' END) AS Thu,
MAX(CASE WHEN DATENAME(dw,d.TheDate) = '금요일' THEN DATENAME(dd,d.TheDate) ELSE '' END) AS Fri,
MAX(CASE WHEN DATENAME(dw,d.TheDate) = '토요일' THEN DATENAME(dd,d.TheDate) ELSE '' END) AS Sat,
MAX(CASE WHEN DATENAME(dw,d.TheDate) = '일요일' THEN DATENAME(dd,d.TheDate) ELSE '' END) AS Sun
FROM (--==== Derived table "d" finds all dates for the given range of dates up to 65535 days apart
SELECT YEAR(@pStartDate+n.Number) AS TheYear,
MONTH(@pStartDate+n.Number) AS TheMonth,
DATEDIFF(dd,@BaseDate,@pStartDate+n.Number)/7 AS TheWeek,
@pStartDate+n.Number AS TheDate
FROM (--==== Derived table "n" creates numbers from 0 to 65535 (about 179 years worth of days)
SELECT t1.Number*256+t2.Number AS Number
FROM Master.dbo.spt_Values t1,
Master.dbo.spt_Values t2
WHERE t1.Type = 'P'
AND t2.Type = 'P'
)n
WHERE @pStartDate+n.Number <= @pEndDate
)d
GROUP BY d.TheYear,d.TheMonth,d.TheWeek
ORDER BY d.TheYear,d.TheMonth,d.TheWeek
GO
-- ----------------------------
-- Auto increment value for Admin_Sys_Param
-- ----------------------------
DBCC CHECKIDENT ('[dbo].[Admin_Sys_Param]', RESEED, 1)
GO
-- ----------------------------
-- Primary Key structure for table Admin_Sys_Param
-- ----------------------------
ALTER TABLE [dbo].[Admin_Sys_Param] ADD CONSTRAINT [PK_Admin_Sys_Param] PRIMARY KEY CLUSTERED ([seq])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
ON [PRIMARY]
GO
-- ----------------------------
-- Auto increment value for AdminRoles
-- ----------------------------
DBCC CHECKIDENT ('[dbo].[AdminRoles]', RESEED, 16)
GO
-- ----------------------------
-- Uniques structure for table GMInfoTable
-- ----------------------------
ALTER TABLE [dbo].[GMInfoTable] ADD CONSTRAINT [UQ__GMInfoTa__72E12F1B09DE7BCC] UNIQUE NONCLUSTERED ([name] ASC)
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
ON [PRIMARY]
GO
-- ----------------------------
-- Primary Key structure for table GMInfoTable
-- ----------------------------
ALTER TABLE [dbo].[GMInfoTable] ADD CONSTRAINT [PK__GMInfoTa__49B921C107020F21] PRIMARY KEY CLUSTERED ([gm_id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
ON [PRIMARY]
GO
-- ----------------------------
-- Auto increment value for GMLoginLog
-- ----------------------------
DBCC CHECKIDENT ('[dbo].[GMLoginLog]', RESEED, 1)
GO
-- ----------------------------
-- Auto increment value for POPUP
-- ----------------------------
DBCC CHECKIDENT ('[dbo].[POPUP]', RESEED, 6)
GO
-- ----------------------------
-- Primary Key structure for table WorldList
-- ----------------------------
ALTER TABLE [dbo].[WorldList] ADD CONSTRAINT [PK_WorldList] PRIMARY KEY CLUSTERED ([world_id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
ON [PRIMARY]
GO
-- ----------------------------
-- Auto increment value for X_6217
-- ----------------------------
DBCC CHECKIDENT ('[dbo].[X_6217]', RESEED, 1)
GO

209872
db/RustyHearts.sql Normal file

File diff suppressed because it is too large Load diff

795
db/RustyHearts_Account.sql Normal file
View file

@ -0,0 +1,795 @@
/*
Navicat Premium Data Transfer
Source Server : RH VM
Source Server Type : SQL Server
Source Server Version : 16001105
Source Host : 192.168.100.202:1433
Source Catalog : RustyHearts_Account
Source Schema : dbo
Target Server Type : SQL Server
Target Server Version : 16001105
File Encoding : 65001
Date: 12/12/2023 01:47:43
*/
-- ----------------------------
-- Table structure for AccountTable
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[AccountTable]') AND type IN ('U'))
DROP TABLE [dbo].[AccountTable]
GO
CREATE TABLE [dbo].[AccountTable] (
[AccountID] int IDENTITY(1,1) NOT NULL,
[WindyCode] varchar(50) COLLATE Chinese_PRC_CI_AS NOT NULL,
[AccountPwd] varchar(255) COLLATE Chinese_PRC_CI_AS NOT NULL,
[Email] varchar(255) COLLATE Chinese_PRC_CI_AS NOT NULL,
[RegisterIP] varchar(16) COLLATE Chinese_PRC_CI_AS NOT NULL,
[CreatedAt] datetime DEFAULT getdate() NOT NULL,
[LastLogin] datetime DEFAULT getdate() NOT NULL,
[IsLocked] bit NOT NULL,
[LoginAttempts] int NOT NULL,
[LastLoginIP] varchar(16) COLLATE Chinese_PRC_CI_AS NOT NULL,
[Token] varchar(255) COLLATE Chinese_PRC_CI_AS NULL
)
GO
ALTER TABLE [dbo].[AccountTable] SET (LOCK_ESCALATION = TABLE)
GO
-- ----------------------------
-- Records of AccountTable
-- ----------------------------
SET IDENTITY_INSERT [dbo].[AccountTable] ON
GO
INSERT INTO [dbo].[AccountTable] ([AccountID], [WindyCode], [AccountPwd], [Email], [RegisterIP], [CreatedAt], [LastLogin], [IsLocked], [LoginAttempts], [LastLoginIP], [Token]) VALUES (N'1', N'ragezone', N'$2a$10$Er7UoQNTihU1ibrX/iSglO3gukkIidUk8P9DthmV5VpfeZ8YOp8kK', N'example@gmail.com', N'192.168.1.1', N'2023-05-27 19:12:19.897', N'2023-12-11 18:45:35.617', N'0', N'0', N'192.168.100.2', N'f3df1542996269928c9f45bd0693269b14cfff39bb72cc3705590957945df170')
GO
SET IDENTITY_INSERT [dbo].[AccountTable] OFF
GO
-- ----------------------------
-- Table structure for BillingLog
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[BillingLog]') AND type IN ('U'))
DROP TABLE [dbo].[BillingLog]
GO
CREATE TABLE [dbo].[BillingLog] (
[bid] int IDENTITY(1,1) NOT NULL,
[BuyTime] datetime NULL,
[WindyCode] varchar(50) COLLATE Chinese_PRC_CI_AS NULL,
[CharId] varchar(128) COLLATE Chinese_PRC_CI_AS NULL,
[UniqueId] varchar(128) COLLATE Chinese_PRC_CI_AS NULL,
[Amount] int NULL,
[ItemId] int NULL,
[ItemCount] int NULL
)
GO
ALTER TABLE [dbo].[BillingLog] SET (LOCK_ESCALATION = TABLE)
GO
-- ----------------------------
-- Records of BillingLog
-- ----------------------------
SET IDENTITY_INSERT [dbo].[BillingLog] ON
GO
SET IDENTITY_INSERT [dbo].[BillingLog] OFF
GO
-- ----------------------------
-- Table structure for CashTable
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[CashTable]') AND type IN ('U'))
DROP TABLE [dbo].[CashTable]
GO
CREATE TABLE [dbo].[CashTable] (
[WindyCode] varchar(255) COLLATE Chinese_PRC_CI_AS NOT NULL,
[WorldId] int NULL,
[Zen] bigint NULL
)
GO
ALTER TABLE [dbo].[CashTable] SET (LOCK_ESCALATION = TABLE)
GO
-- ----------------------------
-- Records of CashTable
-- ----------------------------
INSERT INTO [dbo].[CashTable] ([WindyCode], [WorldId], [Zen]) VALUES (N'ragezone', N'10101', N'500000')
GO
-- ----------------------------
-- Table structure for VerificationCode
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[VerificationCode]') AND type IN ('U'))
DROP TABLE [dbo].[VerificationCode]
GO
CREATE TABLE [dbo].[VerificationCode] (
[id] int IDENTITY(1,1) NOT NULL,
[Email] varchar(255) COLLATE Chinese_PRC_CI_AS NOT NULL,
[VerificationCode] varchar(10) COLLATE Chinese_PRC_CI_AS NOT NULL,
[ExpirationTime] datetime NOT NULL,
[Type] varchar(20) COLLATE Chinese_PRC_CI_AS NOT NULL
)
GO
ALTER TABLE [dbo].[VerificationCode] SET (LOCK_ESCALATION = TABLE)
GO
-- ----------------------------
-- Records of VerificationCode
-- ----------------------------
SET IDENTITY_INSERT [dbo].[VerificationCode] ON
GO
SET IDENTITY_INSERT [dbo].[VerificationCode] OFF
GO
-- ----------------------------
-- procedure structure for GetVerificationCode
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[GetVerificationCode]') AND type IN ('P', 'PC', 'RF', 'X'))
DROP PROCEDURE[dbo].[GetVerificationCode]
GO
CREATE PROCEDURE [dbo].[GetVerificationCode]
@VerificationCode varchar(10),
@Email varchar(255),
@VerificationCodeType varchar(20)
AS
BEGIN
DECLARE @Result varchar(30)
DECLARE @ExpirationTime DATETIME
DECLARE @Now DATETIME = GETDATE()
DECLARE @VerificationCodeExists int;
SELECT @VerificationCodeExists = COUNT(*) FROM VerificationCode
WHERE Email = @Email AND VerificationCode = @VerificationCode AND Type = @VerificationCodeType
-- Check if VerificationCode exists
IF @VerificationCodeExists > 0
SET @Result = 'VerificationCodeExists';
ELSE
SET @Result = 'InvalidVerificationCode';
SELECT @ExpirationTime = ExpirationTime
FROM VerificationCode
WHERE Email = @Email AND VerificationCode = @VerificationCode
IF @Result = 'VerificationCodeExists'
BEGIN
IF @ExpirationTime > @Now
SET @Result = 'ValidVerificationCode';
ELSE
SET @Result = 'ExpiredVerificationCode';
END
SELECT @Result as Result;
END
GO
-- ----------------------------
-- procedure structure for UpdateAccountPassword
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[UpdateAccountPassword]') AND type IN ('P', 'PC', 'RF', 'X'))
DROP PROCEDURE[dbo].[UpdateAccountPassword]
GO
CREATE PROCEDURE [dbo].[UpdateAccountPassword]
@AccountPwd varchar(255),
@Email varchar(255)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @Result varchar(20)
DECLARE @AccountExists int;
BEGIN TRY
BEGIN TRANSACTION
SELECT @AccountExists = COUNT(*) FROM AccountTable
WHERE Email = @Email;
-- Check if account exists
IF @AccountExists > 0
SET @Result = 'AccountExists';
ELSE
SET @Result = 'Failed';
-- Update password
IF @Result = 'AccountExists'
BEGIN
UPDATE AccountTable SET AccountPwd = @AccountPwd
WHERE Email = @Email;
SET @Result = 'PasswordChanged';
END;
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION;
SET @Result = 'TransactionFailed';
END CATCH
SELECT @Result as Result;
END
GO
-- ----------------------------
-- procedure structure for ClearVerificationCode
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[ClearVerificationCode]') AND type IN ('P', 'PC', 'RF', 'X'))
DROP PROCEDURE[dbo].[ClearVerificationCode]
GO
CREATE PROCEDURE [dbo].[ClearVerificationCode]
@Email varchar(255)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @Result varchar(30)
DECLARE @VerificationCodeExists int;
BEGIN TRY
BEGIN TRANSACTION
SELECT @VerificationCodeExists = COUNT(*) FROM VerificationCode
WHERE Email = @Email;
-- Check if VerificationCode exists
IF @VerificationCodeExists > 0
SET @Result = 'VerificationCodeExists';
ELSE
SET @Result = 'NoVerificationCode';
-- DELETE VerificationCodes
IF @Result = 'VerificationCodeExists'
BEGIN
DELETE FROM VerificationCode WHERE Email = @Email;
SET @Result = 'VerificationCodeClean';
END;
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION;
SET @Result = 'TransactionFailed';
END CATCH
SELECT @Result as Result;
END
GO
-- ----------------------------
-- procedure structure for GetAccount
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[GetAccount]') AND type IN ('P', 'PC', 'RF', 'X'))
DROP PROCEDURE[dbo].[GetAccount]
GO
CREATE PROCEDURE [dbo].[GetAccount]
@Identifier varchar(255)
AS
BEGIN
DECLARE @Result varchar(20)
DECLARE @AccountExists int;
DECLARE @WindyCode varchar(50)
DECLARE @AccountPwd varchar(255)
SELECT @AccountExists = COUNT(*) FROM AccountTable
WHERE Email = @Identifier OR WindyCode = @Identifier;
SELECT @WindyCode = WindyCode FROM AccountTable
WHERE Email = @Identifier OR WindyCode = @Identifier;
SELECT @AccountPwd = AccountPwd FROM AccountTable
WHERE Email = @Identifier OR WindyCode = @Identifier;
-- Check if account exists
IF @AccountExists > 0
SET @Result = 'AccountExists';
ELSE
SET @Result = 'AccountNotFound';
SELECT @Result as Result, @WindyCode as WindyCode, @AccountPwd as AccountPwd;
END
GO
-- ----------------------------
-- procedure structure for GetCurrency
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[GetCurrency]') AND type IN ('P', 'PC', 'RF', 'X'))
DROP PROCEDURE[dbo].[GetCurrency]
GO
CREATE PROCEDURE [dbo].[GetCurrency]
@UserId varchar(50),
@ServerId int
AS
BEGIN
SET NOCOUNT ON
DECLARE @Result varchar(20)
DECLARE @Zen int;
BEGIN TRY
BEGIN TRANSACTION
-- Check if entry with given UserId and ServerId exists
SELECT @Zen = Zen FROM CashTable
WHERE WindyCode = @UserId AND WorldId = @ServerId;
IF @@ROWCOUNT > 0 -- entry exists
BEGIN
SET @Result = 'Success';
END
ELSE -- entry does not exist, insert new one
BEGIN
INSERT INTO CashTable (WindyCode, WorldId, Zen)
VALUES (@UserId, @ServerId, 0);
SET @Result = 'Success';
SET @Zen = 0;
END;
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION;
SET @Result = 'TransactionFailed';
SET @Zen = 0;
END CATCH
SELECT @Result as Result, @Zen as Zen;
END
GO
-- ----------------------------
-- procedure structure for SetPasswordVerificationCode
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[SetPasswordVerificationCode]') AND type IN ('P', 'PC', 'RF', 'X'))
DROP PROCEDURE[dbo].[SetPasswordVerificationCode]
GO
CREATE PROCEDURE [dbo].[SetPasswordVerificationCode]
@VerificationCode varchar(10),
@Email varchar(255),
@ExpirationTime DATETIME
AS
BEGIN
SET NOCOUNT ON;
DECLARE @Result varchar(20);
DECLARE @VerificationCodeCount int;
BEGIN TRY
BEGIN TRANSACTION;
-- Retrieve count of existing verification codes for the user
SELECT @VerificationCodeCount = COUNT(*) FROM VerificationCode
WHERE Email = @Email;
-- Check if count of existing verification codes is less than 5
IF @VerificationCodeCount < 5
BEGIN
-- Insert new verification code
INSERT INTO VerificationCode (VerificationCode, Email, ExpirationTime, Type)
VALUES (@VerificationCode, @Email, @ExpirationTime, 'Password');
SET @Result = 'Success';
END
ELSE
BEGIN
-- Delete all existing verification codes for the user
DELETE FROM VerificationCode WHERE Email = @Email;
-- Insert new verification code
INSERT INTO VerificationCode (VerificationCode, Email, ExpirationTime, Type)
VALUES (@VerificationCode, @Email, @ExpirationTime, 'Password');
SET @Result = 'Success';
END;
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION;
SET @Result = 'TransactionFailed';
END CATCH;
SELECT @Result as Result;
END;
GO
-- ----------------------------
-- procedure structure for SetCurrency
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[SetCurrency]') AND type IN ('P', 'PC', 'RF', 'X'))
DROP PROCEDURE[dbo].[SetCurrency]
GO
CREATE PROCEDURE [dbo].[SetCurrency]
@UserId varchar(50),
@ServerId int,
@NewBalance int
AS
BEGIN
SET NOCOUNT ON
DECLARE @Result varchar(20)
DECLARE @Zen int;
BEGIN TRY
BEGIN TRANSACTION
-- Check if entry with given UserId and ServerId exists
SELECT @Zen = Zen FROM CashTable
WHERE WindyCode = @UserId AND WorldId = @ServerId;
IF @@ROWCOUNT > 0 -- entry exists
BEGIN
UPDATE CashTable SET Zen = @NewBalance
WHERE WindyCode = @UserId AND WorldId = @ServerId;
SET @Zen = @NewBalance;
SET @Result = 'Success';
END
ELSE -- entry does not exist
BEGIN
SET @Result = 'Failed';
END;
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION;
SET @Result = 'TransactionFailed';
END CATCH
SELECT @Result as Result, @Zen as Zen;
END
GO
-- ----------------------------
-- procedure structure for SetBillingLog
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[SetBillingLog]') AND type IN ('P', 'PC', 'RF', 'X'))
DROP PROCEDURE[dbo].[SetBillingLog]
GO
CREATE PROCEDURE [dbo].[SetBillingLog]
(
@userid varchar(50),
@charid varchar(128),
@uniqueid varchar(128),
@amount int,
@itemid int,
@itemcount int
)
AS
BEGIN
SET NOCOUNT ON;
BEGIN TRY
-- Insert the values into the BillingLog table
INSERT INTO BillingLog (BuyTime, WindyCode, CharId, UniqueId, Amount, ItemId, ItemCount)
VALUES (GETDATE(), @userid, @charid, @uniqueid, @amount, @itemid, @itemcount);
-- Return a success message
SELECT 'Success' AS Result;
END TRY
BEGIN CATCH
-- Log the error and return an error message
DECLARE @errorMessage varchar(4000) = ERROR_MESSAGE();
RAISERROR(@errorMessage, 16, 1);
-- Return an error message
SELECT 'Error: ' + @errorMessage AS Result;
END CATCH;
END;
GO
-- ----------------------------
-- procedure structure for CreateAccount
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[CreateAccount]') AND type IN ('P', 'PC', 'RF', 'X'))
DROP PROCEDURE[dbo].[CreateAccount]
GO
CREATE PROCEDURE [dbo].[CreateAccount]
@WindyCode varchar(50),
@AccountPwd varchar(255),
@Email varchar(255),
@RegisterIP varchar(16)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @Result varchar(20)
DECLARE @AccountExists int;
DECLARE @WindyCodeExists int;
BEGIN TRY
BEGIN TRANSACTION
SELECT @AccountExists = COUNT(*) FROM AccountTable
WHERE WindyCode = @WindyCode OR Email = @Email;
SELECT @WindyCodeExists = COUNT(*) FROM RustyHearts_Auth.dbo.AuthTable
WHERE WindyCode = @WindyCode;
-- Check if account exists
IF @AccountExists > 0
SET @Result = 'AccountExists';
ELSE IF @WindyCodeExists > 0
SET @Result = 'WindyCodeExists';
ELSE
SET @Result = 'NewUser';
-- Create new account
IF @Result = 'NewUser'
BEGIN
INSERT INTO AccountTable (WindyCode, AccountPwd, Email, RegisterIP, CreatedAt, LastLogin, IsLocked, LoginAttempts, LastLoginIP)
VALUES (@WindyCode, @AccountPwd, @Email, @RegisterIP, GETDATE(), GETDATE(), 0, 0, @RegisterIP);
INSERT INTO RustyHearts_Auth.dbo.AuthTable (WindyCode, world_id, AuthID, Tcount, online, CTime, BTime, LTime, IP, LCount, ServerIP, ServerType, HostID, DBCIndex, InquiryCount, event_inquiry, CashMileage, channelling, pc_room_point, externcash, mac_addr, mac_addr02, mac_addr03, second_pass)
VALUES (@WindyCode, 0, NEWID(), 0, '0', GETDATE(), GETDATE(), GETDATE(), @RegisterIP, 0, 0, 0, 0, 0, 5, 1, 0, 1, 0, 0, '00-00-00-00-00-00', '00-00-00-00-00-00', '00-00-00-00-00-00', '');
INSERT INTO CashTable (WindyCode, WorldId, Zen)
VALUES (@WindyCode, 10101, 0);
SET @Result = 'AccountCreated';
END;
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION;
SET @Result = 'TransactionFailed';
END CATCH
SELECT @Result as Result;
END
GO
-- ----------------------------
-- procedure structure for AuthenticateUser
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[AuthenticateUser]') AND type IN ('P', 'PC', 'RF', 'X'))
DROP PROCEDURE[dbo].[AuthenticateUser]
GO
CREATE PROCEDURE [dbo].[AuthenticateUser]
@Identifier varchar(255),
@password_verify_result BIT,
@LastLoginIP varchar(15)
AS
BEGIN
SET NOCOUNT ON;
DECLARE @Result varchar(20)
DECLARE @WindyCode varchar(50)
DECLARE @AuthID varchar(50)
DECLARE @LoginAttempts int
DECLARE @IsLocked BIT
DECLARE @Now datetime = GETDATE()
DECLARE @LastLogin datetime
DECLARE @Token NVARCHAR(64)
DECLARE @RandomBytes VARBINARY(32)
BEGIN TRY
BEGIN TRANSACTION
-- Retrieve account information
SELECT @WindyCode = WindyCode, @LoginAttempts = LoginAttempts, @IsLocked = IsLocked, @LastLogin = LastLogin
FROM AccountTable
WHERE WindyCode = @Identifier OR Email = @Identifier;
SELECT @AuthID = AuthID
FROM RustyHearts_Auth.dbo.AuthTable
WHERE WindyCode = @WindyCode;
-- Check if last login attempt is within 5 minutes
IF DATEDIFF(minute, @LastLogin, @Now) > 5
BEGIN
UPDATE AccountTable SET LoginAttempts = 0 WHERE WindyCode = @Identifier OR Email = @Identifier;
END
-- Verify password
IF @password_verify_result = 1
BEGIN
SET @Result = 'LoginSuccess';
SET @RandomBytes = CAST(CRYPT_GEN_RANDOM(32) AS VARBINARY(32)) -- Generate 32 random bytes
SET @Token = LOWER(CONVERT(NVARCHAR(64), HashBytes('SHA2_256', @RandomBytes), 2)) -- Hash the random bytes using SHA256 and convert to lowercase hexadecimal string
END
ELSE
SET @Result = 'InvalidCredentials';
-- Check account status
IF @Result = 'LoginSuccess' AND @IsLocked = 1
SET @Result = 'Locked';
ELSE IF @LoginAttempts >= 10
SET @Result = 'TooManyAttempts';
ELSE
-- Update login attempts, token, and last login IP
IF @Result = 'LoginSuccess'
BEGIN
UPDATE AccountTable SET LoginAttempts = 0, Token = @Token, LastLoginIP = @LastLoginIP, LastLogin = @Now WHERE (WindyCode = @Identifier OR Email = @Identifier);
END
ELSE IF @Result = 'InvalidCredentials'
BEGIN
UPDATE AccountTable SET LoginAttempts = @LoginAttempts + 1, LastLogin = @Now WHERE (WindyCode = @Identifier OR Email = @Identifier);
END
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION;
SET @Result = 'TransactionFailed';
END CATCH
SELECT @Result as Result, @WindyCode as WindyCode, @AuthID as AuthID, @Token as Token;
END
GO
-- ----------------------------
-- procedure structure for SetAccountVerificationCode
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[SetAccountVerificationCode]') AND type IN ('P', 'PC', 'RF', 'X'))
DROP PROCEDURE[dbo].[SetAccountVerificationCode]
GO
CREATE PROCEDURE [dbo].[SetAccountVerificationCode]
@VerificationCode varchar(10),
@Email varchar(255),
@ExpirationTime DATETIME
AS
BEGIN
SET NOCOUNT ON;
DECLARE @Result varchar(20)
DECLARE @AccountExists int;
DECLARE @VerificationCodeCount int;
BEGIN TRY
BEGIN TRANSACTION
SELECT @AccountExists = COUNT(*) FROM AccountTable
WHERE Email = @Email;
-- Check if account exists
IF @AccountExists > 0
SET @Result = 'AccountExists';
ELSE
SET @Result = 'AccountDontExists';
IF @Result = 'AccountDontExists'
-- Retrieve count of existing verification codes for the user
SELECT @VerificationCodeCount = COUNT(*) FROM VerificationCode
WHERE Email = @Email;
-- Check if count of existing verification codes is less than 5
IF @VerificationCodeCount < 5
BEGIN
-- Insert new verification code
INSERT INTO VerificationCode (VerificationCode, Email, ExpirationTime, Type)
VALUES (@VerificationCode, @Email, @ExpirationTime, 'Account');
SET @Result = 'Success';
END
ELSE
BEGIN
-- Delete all existing verification codes for the user
DELETE FROM VerificationCode WHERE Email = @Email;
-- Insert new verification code
INSERT INTO VerificationCode (VerificationCode, Email, ExpirationTime, Type)
VALUES (@VerificationCode, @Email, @ExpirationTime, 'Account');
SET @Result = 'Success';
END;
COMMIT TRANSACTION;
END TRY
BEGIN CATCH
ROLLBACK TRANSACTION;
SET @Result = 'TransactionFailed';
END CATCH
SELECT @Result as Result;
END
GO
-- ----------------------------
-- Auto increment value for AccountTable
-- ----------------------------
DBCC CHECKIDENT ('[dbo].[AccountTable]', RESEED, 1)
GO
-- ----------------------------
-- Primary Key structure for table AccountTable
-- ----------------------------
ALTER TABLE [dbo].[AccountTable] ADD CONSTRAINT [PK__AccountT__349DA586E13EC640] PRIMARY KEY CLUSTERED ([AccountID])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
ON [PRIMARY]
GO
-- ----------------------------
-- Auto increment value for BillingLog
-- ----------------------------
DBCC CHECKIDENT ('[dbo].[BillingLog]', RESEED, 1)
GO
-- ----------------------------
-- Primary Key structure for table BillingLog
-- ----------------------------
ALTER TABLE [dbo].[BillingLog] ADD CONSTRAINT [PK_BillingLog] PRIMARY KEY CLUSTERED ([bid])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
ON [PRIMARY]
GO
-- ----------------------------
-- Auto increment value for VerificationCode
-- ----------------------------
DBCC CHECKIDENT ('[dbo].[VerificationCode]', RESEED, 1)
GO
-- ----------------------------
-- Primary Key structure for table VerificationCode
-- ----------------------------
ALTER TABLE [dbo].[VerificationCode] ADD CONSTRAINT [PK__Password__3213E83FA2A48C58] PRIMARY KEY CLUSTERED ([id])
WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON)
ON [PRIMARY]
GO

2275
db/RustyHearts_Auth.sql Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,99 @@
-- ----------------------------
-- Table structure for RealTimeEventTable
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[RealTimeEventTable]') AND type IN ('U'))
DROP TABLE [dbo].[RealTimeEventTable]
GO
CREATE TABLE [dbo].[RealTimeEventTable] (
[id] int DEFAULT 0 NOT NULL,
[value] int DEFAULT 0 NOT NULL,
[information] varchar(128) COLLATE Chinese_PRC_CI_AS DEFAULT '' NOT NULL
)
GO
ALTER TABLE [dbo].[RealTimeEventTable] SET (LOCK_ESCALATION = TABLE)
GO
-- ----------------------------
-- Records of RealTimeEventTable
-- ----------------------------
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'1', N'1', N'Fatigue Recovery')
GO
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'2', N'2', N'Resurrection Scroll Charge (5 pieces)')
GO
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'3', N'2', N'Fortune')
GO
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'4', N'2', N'Daily Mail Attachment')
GO
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'5', N'8', N'Monster Hunting Experience Increase')
GO
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'6', N'8', N'Monster Hunting Experience Increase')
GO
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'7', N'9', N'Real-time Monster Hunting Experience Increase 1.5x')
GO
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'8', N'9', N'Real-time Monster Hunting Experience Increase 2x')
GO
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'9', N'9', N'Real-time Monster Hunting Experience Increase 2.5x')
GO
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'10', N'9', N'Real-time Monster Hunting Experience Increase 3x')
GO
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'11', N'9', N'Real-time Monster Hunting Experience Increase 5x')
GO
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'12', N'9', N'Monster Item Drop 2x')
GO
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'13', N'9', N'NewYear_Event_poison')
GO
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'14', N'9', N'ValentineDay_Event_poison')
GO
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'15', N'9', N'WhiteDay_Event_poison')
GO
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'16', N'9', N'Event_poison04')
GO
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'17', N'9', N'Family_Event_poison')
GO
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'18', N'9', N'Event_poison06')
GO
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'19', N'9', N'Summer_Event_poison')
GO
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'20', N'9', N'Event_poison08')
GO
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'21', N'9', N'Halloween_Event_poison')
GO
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'22', N'9', N'Thanks_Event_poison')
GO
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'23', N'9', N'Event_poison11')
GO
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'24', N'9', N'X-mas_poison')
GO
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'25', N'2', N'PVP Ladder Reset')
GO
INSERT INTO [dbo].[RealTimeEventTable] ([id], [value], [information]) VALUES (N'26', N'2', N'Daily Party Challenge Quest Reset')
GO

7903
db/RustyHearts_Log.sql Normal file

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,264 @@
/*
RustyHearts Database procedure fixes for up_item_update_itemcode_option, up_insert_rearing_info, up_mail_gold_payment
*/
-- ----------------------------
-- procedure structure for up_item_update_itemcode_option
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[up_item_update_itemcode_option]') AND type IN ('P', 'PC', 'RF', 'X'))
DROP PROCEDURE[dbo].[up_item_update_itemcode_option]
GO
CREATE PROCEDURE [dbo].[up_item_update_itemcode_option]
(
@item_id [uniqueidentifier],
@item_code int,
@opt_code01 int,
@opt_code02 int,
@opt_code03 int,
@opt_value01 int,
@opt_value02 int,
@opt_value03 int,
@unknonw_param int -- ???
)
as
set nocount on
if exists ( select [item_uid] from [dbo].N_InventoryItem WITH (NOLOCK) where item_uid = @item_id )
begin
update [dbo].N_InventoryItem set
code = @item_code,
option_1_code = @opt_code01,
option_2_code = @opt_code02,
option_3_code = @opt_code03,
option_1_value = @opt_value01,
option_2_value = @opt_value02,
option_3_value = @opt_value03
where item_uid = @item_id;
end
else
begin
update [dbo].N_EquipItem set
code = @item_code,
option_1_code = @opt_code01,
option_2_code = @opt_code02,
option_3_code = @opt_code03,
option_1_value = @opt_value01,
option_2_value = @opt_value02,
option_3_value = @opt_value03
where item_uid = @item_id;
end
return @@error
GO
-- ----------------------------
-- procedure structure for up_insert_rearing_info
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[up_insert_rearing_info]') AND type IN ('P', 'PC', 'RF', 'X'))
DROP PROCEDURE[dbo].[up_insert_rearing_info]
GO
CREATE PROCEDURE [dbo].[up_insert_rearing_info]
@table_id tinyint,
@group_id tinyint,
@reating_id [uniqueidentifier],
@char_id [uniqueidentifier],
@type tinyint,
@name nvarchar(16),
@job tinyint,
@level int,
@index tinyint,
@actionpoint int,
@usedturn int,
@endingid int,
@rewarditem int,
@createtime bigint,
@vital int,
@intelligence int,
@strength int,
@temper int,
@charm int,
@exhaust int,
@angry int,
@normal int,
@good int,
@sadness int,
@height int,
@weight int,
@resilent int = 0,
@eloquence int = 0
as
set nocount on
set xact_abort on
begin
BEGIN TRAN
insert dbo.RearingTable
(
[table_id],
[group_id],
[rearing_id],
[char_id],
[type],
[name],
[job],
[level],
[index],
[actionpoint],
[usedturn],
[endingid],
[rewarditem],
[createtime],
[vital],
[intelligence],
[strength],
[temper],
[charm],
[exhaust],
[angry],
[normal],
[good],
[sadness],
[height],
[weight],
[resilent],
[eloquence]
)
values(
@table_id,
@group_id,
@reating_id,
@char_id,
@type,
@name,
@job,
@level,
@index,
@actionpoint,
@usedturn,
@endingid,
@rewarditem,
@createtime,
@vital,
@intelligence,
@strength,
@temper,
@charm,
@exhaust,
@angry,
@normal,
@good,
@sadness,
@height,
@weight,
@resilent,
@eloquence
)
if(@@error <> 0 )
begin
ROLLBACK TRAN
return
end
COMMIT TRAN
end
GO
-- ----------------------------
-- procedure structure for up_mail_gold_payment
-- ----------------------------
IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[dbo].[up_mail_gold_payment]') AND type IN ('P', 'PC', 'RF', 'X'))
DROP PROCEDURE[dbo].[up_mail_gold_payment]
GO
CREATE PROCEDURE [dbo].[up_mail_gold_payment]
@mail_id [uniqueidentifier],
@msg nvarchar(350) = 'Bill'
as
set nocount on
declare @character_id [uniqueidentifier],
@sender_character_id [uniqueidentifier],
@NewMailID [uniqueidentifier]
declare @sender_name nvarchar(16),
@recver_name nvarchar(16)
declare @my_money int,
@req_money int
begin tran
if EXISTS (select [ID] from MailTable with (READUNCOMMITTED) where [ID] = @mail_id)
begin
--
select
@character_id = [character_id]
,@recver_name = [receiver]
,@sender_character_id = [send_character_id]
,@sender_name = [sender]
,@req_money = [req_gold]
from MailTable with (READUNCOMMITTED) where [ID] = @mail_id
--
SELECT @my_money = [gold] FROM [dbo].[CharacterTable] with (READUNCOMMITTED) where [character_id] = @character_id
-- 捣 昏力
if (@my_money - @req_money) > 0
begin
UPDATE [dbo].[CharacterTable] SET [gold] = (@my_money - @req_money) WHERE [character_id] = @character_id
end
else
begin
UPDATE [dbo].[CharacterTable] SET [gold] = 0 WHERE [character_id] = @character_id
end
-- 措陛 皋老 眠啊
insert into MailTable
values
( NEWID(), --0
@sender_character_id, --1
@sender_name, --2
@character_id, --3
@recver_name, --4
@msg, --3
@req_money, --4
0,
0,
0, --8
GETDATE(),
6 -- 措陛 快祈
);
--
UPDATE [dbo].[MailTable]
SET
[return_day] = 0
,[req_gold] = 0
,[is_open] = 0
,[create_type] = 0
WHERE [ID] = @mail_id
--
select * from dbo.MailTable with (READUNCOMMITTED) where [ID] = @mail_id
end
declare @ERR int
SET @ERR = @@ERROR
IF @ERR <> 0 BEGIN
RAISERROR('贸府坷幅', 16, 10)
IF @@TRANCOUNT <> 0 ROLLBACK
RETURN (@ERR)
END
COMMIT TRAN
GO