Files
ls-2014-source/database/08_fixes_and_accounts.sql

60 lines
2.7 KiB
Transact-SQL

-- LosaDev 2014: fixes for the 2014 servers on top of the May 2012 scripts, plus test accounts.
USE [LosaGame];
GO
-- 1. The 2014 game server sends its 64-bit server ID (query 3), the 2012 procedure expected the row index.
ALTER PROCEDURE [dbo].[game_server_connection_on]
(
@serverID bigint
)
AS
UPDATE define_game_server SET [status] = 1 WHERE serverID = @serverID
GO
-- 2. Second encryption key (query 5, game_encode_get_fix_key). The login key's ID part is encrypted
-- with it. Shorter than 16 characters.
IF NOT EXISTS (SELECT * FROM define_encode_key)
INSERT INTO define_encode_key (encodeKey, regDate) VALUES ('$(ENCODE_KEY)', getdate());
GO
-- 3. Test accounts. The game server (Korea mode) checks userMemberDB.userID + userLoginDB.encodeKey;
-- there is no password check on the server: the launcher/web normally writes a fresh encodeKey
-- and passes it to the client (tools\start-client.ps1 does that here).
CREATE PROCEDURE [dbo].[lshub_add_test_account]
(
@userID varchar(12)
, @nickName varchar(20)
)
AS
SET NOCOUNT ON
IF EXISTS (SELECT * FROM userMemberDB WHERE userID = @userID) RETURN
INSERT INTO userMemberDB (userID, nickName, userPWD, EMail, mailling, userType, joinType, limitType, limitDate, regDate)
VALUES (@userID, @nickName, '', '', 0, 0, 0, 0, '1999-01-01', getdate())
DECLARE @accountIDX int = (SELECT accountIDX FROM userMemberDB WHERE userID = @userID)
INSERT INTO userGameDB (accountIDX, userState, gameMoney, playTime, conn_count, userLevel, userEXP, rencpoint, renspoint, relateLevel, regionType, connDate, regDate)
VALUES (@accountIDX, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '2000-01-01', getdate())
INSERT INTO userRecordBattleDB (accountIDX, regDate) VALUES (@accountIDX, getdate())
INSERT INTO userLoginDB (accountIDX, encodeKey, gameServerID, connDate) VALUES (@accountIDX, '111111111111111', 0, getdate())
GO
-- Resets the login key before a client start (what the web login did). Returns the key.
CREATE PROCEDURE [dbo].[lshub_set_login_key]
(
@userID varchar(12)
, @encodeKey char(15)
)
AS
SET NOCOUNT ON
UPDATE userLoginDB SET encodeKey = @encodeKey, gameServerID = 0, connDate = getdate()
WHERE accountIDX = (SELECT accountIDX FROM userMemberDB WHERE userID = @userID)
SELECT encodeKey, (SELECT TOP 1 encodeKey FROM define_encode_key ORDER BY idx DESC) AS secondKey
FROM userLoginDB WHERE accountIDX = (SELECT accountIDX FROM userMemberDB WHERE userID = @userID)
GO
EXEC lshub_add_test_account 'test1', 'Tester1';
EXEC lshub_add_test_account 'test2', 'Tester2';
-- GM: the game server treats a nickname that starts with an [ID_LIKE] prefix from
-- ls_gamesvr\config\sp2_developerID.ini (here "[GM]") as a developer.
EXEC lshub_add_test_account 'gmtest1', '[GM]Admin';
GO