LosaDev source snapshot 2014

This commit is contained in:
LosaDev committed 2026-11-07 13:30:44 +07:00
commit 224e4bc926
20515 files changed
+10729105

No files matched your search

+266
View File
@@ -0,0 +1,266 @@
-- Generated. Real tables and procedures from the 2021 release for features that were stubs in the 2014 testbed.
USE [LosaGame]
GO
IF OBJECT_ID('dbo.game_character_get_list') IS NOT NULL DROP PROCEDURE dbo.game_character_get_list
GO
CREATE PROCEDURE [dbo].[game_character_get_list]
(
@accountIDX INT
)
AS
SET NOCOUNT ON
SELECT idx, ClassType,
CI_type, CI_gender, CI_beard, CI_face, CI_hair, CI_skinColor, CI_hairColor, CI_trinket, CI_underwear,
EI1_type, EI2_type, EI3_type, EI4_type, CI_position,
limitTime, limitType, leaderType, rentalType, rentalTime, awakeType, awakeTime
FROM dbo.userCharacterDB WITH(NOLOCK)
WHERE accountIDX = @accountIDX
ORDER BY idx ASC
GO
IF OBJECT_ID('dbo.game_class_get_list') IS NOT NULL DROP PROCEDURE dbo.game_class_get_list
GO
CREATE PROCEDURE [dbo].[game_class_get_list]
(
@accountIDX INT
)
AS
SET NOCOUNT ON
SELECT idx,
class1_type, class1_level, class1_expert, class1_stat, class2_type, class2_level, class2_expert, class2_stat,
class3_type, class3_level, class3_expert, class3_stat, class4_type, class4_level, class4_expert, class4_stat,
class5_type, class5_level, class5_expert, class5_stat, class6_type, class6_level, class6_expert, class6_stat,
class7_type, class7_level, class7_expert, class7_stat, class8_type, class8_level, class8_expert, class8_stat,
class9_type, class9_level, class9_expert, class9_stat, class10_type, class10_level, class10_expert, class10_stat
FROM dbo.userClassDB WITH(NOLOCK)
WHERE accountIDX = @accountIDX
ORDER BY idx ASC
GO
IF OBJECT_ID('dbo.game_game_get_data') IS NOT NULL DROP PROCEDURE dbo.game_game_get_data
GO
CREATE PROCEDURE [dbo].[game_game_get_data]
(
@userID varchar(12)
)
As
SET NOCOUNT ON
DECLARE @CURRENTDATE DATETIME
DECLARE @CONNECTDATE DATETIME
SET @CURRENTDATE = GETDATE();
SET @CONNECTDATE = ( SELECT conndate FROM dbo.userGameDB WHERE accountIDX IN ( SELECT accountIDX FROM dbo.userMemberDB WHERE userID = @userID ))
BEGIN
IF( @CURRENTDATE < @CONNECTDATE )
SET @CONNECTDATE = @CURRENTDATE
END
SELECT a.accountIDX, b.userID, b.nickName, a.userState, a.gameMoney
, a.conn_count, @CONNECTDATE, a.userLevel, a.userEXP--, a.relateLevel
, b.eventType, isNull(c.class,0) as 'class', b.joinType, b.regDate, a.regionType
, a.rencpoint, a.renspoint, isNull(c.region,0) as 'region', b.cpType, ISNULL(d.cpID, '') AS 'cpID'
, ISNULL(d.note, '') AS 'cpUNIQ', b.limitType, b.limitDate, a.userFishingLevel, a.userFishingEXP
, a.refillData, a.userExcavationLevel, a.userExcavationEXP, a.userHerocEXP, a.userHerosEXP, a.practice
FROM userGameDB a WITH( NOLOCK )
JOIN userMemberDB b WITH( NOLOCK )
ON a.accountIDX = b.accountIDX
LEFT JOIN userRankingDB c WITH( NOLOCK )
ON a.accountIDX = c.accountIDX
LEFT JOIN userCooperationDB d WITH( NOLOCK )
ON a.accountIDX=d.accountIDX WHERE b.userID = @userID
GO
IF OBJECT_ID('dbo.game_game_save') IS NOT NULL DROP PROCEDURE dbo.game_game_save
GO
CREATE PROCEDURE [dbo].[game_game_save]
(
@accountIDX int
, @userState int
, @gameMoney bigint
, @conn_count int
, @connDate datetime
, @userLevel int
, @userEXP int
, @playTime int
, @regionType int
, @userFishingLevel int
, @userFishingEXP int
, @refillData int
, @userExcavationLevel int
, @userExcavationEXP int
, @init_time int
)
As
SET NOCOUNT ON
IF @userLevel < 50
BEGIN
-- 기존 루틴 그대로
UPDATE dbo.userGameDB
SET gameMoney = @gameMoney
, userState = @userState
, playTime = playTime + Round((@playTime/1000)/60,0)
, conn_count = @conn_count
, userLevel = @userLevel
, userEXP = @userEXP
, userFishingLevel = @userFishingLevel
, userFishingEXP = @userFishingEXP
, regionType = @regionType
, connDate = @connDate
, refillData = @refillData
, userExcavationLevel = @userExcavationLevel
, userExcavationEXP = @userExcavationEXP
, Practice = 0
WHERE accountIDX = @accountIDX
END
ELSE
BEGIN
--
IF( EXISTS( SELECT * FROM dbo.userRelativeLevelDB WITH( NOLOCK )
WHERE accountIDX = @accountIDX ) )
BEGIN
UPDATE dbo.userGameDB
SET gameMoney = @gameMoney
, userState = @userState
, playTime = playTime + Round((@playTime/1000)/60,0)
, conn_count = @conn_count
--, userLevel = @userLevel
, userEXP = @userEXP
, userFishingLevel = @userFishingLevel
, userFishingEXP = @userFishingEXP
, regionType = @regionType
, connDate = @connDate
, refillData = @refillData
, userExcavationLevel = @userExcavationLevel
, userExcavationEXP = @userExcavationEXP
, Practice = 0
WHERE accountIDX = @accountIDX
UPDATE dbo.userRelativeLevelDB
SET init_time = @init_time
WHERE accountIDX = @accountIDX
END
ELSE
BEGIN
-- 기존 루틴 그대로 : 혹시나 ?
UPDATE dbo.userGameDB
SET gameMoney = @gameMoney
, userState = @userState
, playTime = playTime + Round((@playTime/1000)/60,0)
, conn_count = @conn_count
, userLevel = @userLevel
, userEXP = @userEXP
, userFishingLevel = @userFishingLevel
, userFishingEXP = @userFishingEXP
, regionType = @regionType
, connDate = @connDate
, refillData = @refillData
, userExcavationLevel = @userExcavationLevel
, userExcavationEXP = @userExcavationEXP
, Practice = 0
WHERE accountIDX = @accountIDX
END
END
GO
IF OBJECT_ID('dbo.game_item_extra_get_list') IS NOT NULL DROP PROCEDURE dbo.game_item_extra_get_list
GO
CREATE PROCEDURE [dbo].[game_item_extra_get_list]
(
@idx INT
, @accountIDX INT
, @getCount int
)
AS
SET NOCOUNT ON
SELECT TOP (@getCount) idx,
item1_type, item1_reinforce, item1_slotindex, item1_tradetype, item1_limitType, item1_mcustom, item1_fcustom, item1_failexp, item1_limitDate,
item2_type, item2_reinforce, item2_slotindex, item2_tradetype, item2_limitType, item2_mcustom, item2_fcustom, item2_failexp, item2_limitDate,
item3_type, item3_reinforce, item3_slotindex, item3_tradetype, item3_limitType, item3_mcustom, item3_fcustom, item3_failexp, item3_limitDate,
item4_type, item4_reinforce, item4_slotindex, item4_tradetype, item4_limitType, item4_mcustom, item4_fcustom, item4_failexp, item4_limitDate,
item5_type, item5_reinforce, item5_slotindex, item5_tradetype, item5_limitType, item5_mcustom, item5_fcustom, item5_failexp, item5_limitDate,
item6_type, item6_reinforce, item6_slotindex, item6_tradetype, item6_limitType, item6_mcustom, item6_fcustom, item6_failexp, item6_limitDate,
item7_type, item7_reinforce, item7_slotindex, item7_tradetype, item7_limitType, item7_mcustom, item7_fcustom, item7_failexp, item7_limitDate,
item8_type, item8_reinforce, item8_slotindex, item8_tradetype, item8_limitType, item8_mcustom, item8_fcustom, item8_failexp, item8_limitDate,
item9_type, item9_reinforce, item9_slotindex, item9_tradetype, item9_limitType, item9_mcustom, item9_fcustom, item9_failexp, item9_limitDate,
item10_type, item10_reinforce, item10_slotindex, item10_tradetype, item10_limitType, item10_mcustom, item10_fcustom, item10_failexp, item10_limitDate
FROM dbo.userItemExtraDB WITH (NOLOCK)
WHERE accountIDX = @accountIDX
AND idx > @idx
ORDER BY idx ASC
GO
IF OBJECT_ID('dbo.game_guild_login_get_data') IS NOT NULL DROP PROCEDURE dbo.game_guild_login_get_data
GO
-- =============================================
-- Subject : dbo.game_guild_login_get_data
-- DBA : KeuN
-- DATE : 2015-08-24 09:43
-- Description : 길드원 데이터 SELECT (길드본부 추가)
-- =============================================
CREATE PROCEDURE [dbo].[game_guild_login_get_data]
(
@ACCOUNT_IDX int
)
AS
SET NOCOUNT ON
DECLARE @GUILD_IDX INT = 0;
DECLARE @GUILD_HQ TINYINT = 0;
-- 길드 본부 활성화 여부 확인
SET @GUILD_IDX = (SELECT guildIDX FROM dbo.userGuildInfoDB WHERE AccountIDX=@ACCOUNT_IDX)
IF (@GUILD_IDX<>0) or (@GUILD_IDX IS NOT NULL)
BEGIN
IF EXISTS (SELECT * FROM dbo.userGuildHQDB WHERE GuildIDX=@GUILD_IDX)
BEGIN
SET @GUILD_HQ=1
END
END
-- 사용자 길드 관련 데이터 세팅
SELECT B.idx, B.guildName, B.guildmark, A.guildPosition, A.msg, A.AttendDate, A.GuildRankDate, A.regDate, @GUILD_HQ
FROM dbo.userGuildInfoDB as A WITH(READUNCOMMITTED) INNER JOIN dbo.userGuildDB AS B WITH(READUNCOMMITTED)
ON A.guildIDX = B.idx
WHERE A.accountIDX = @ACCOUNT_IDX
AND A.guildJoinType in (-1, 1)
GO
IF OBJECT_ID('dbo.game_guild_get_list') IS NOT NULL DROP PROCEDURE dbo.game_guild_get_list
GO
CREATE PROCEDURE [dbo].[game_guild_get_list]
(
@topn int
, @idx int
)
AS
SET NOCOUNT ON
SELECT TOP (@topn) a.idx, a.guildName, a.aboutguild, a.guildmark, a.point, a.maxcount, a.regDate,
a.membercount, a.todaypoint, a.guildLevel,
b.type1_win, b.type1_lose, b.type1_kill, b.type1_death
FROM dbo.userGuildDB a WITH(NOLOCK)
INNER JOIN dbo.userRecordGuildDB b WITH(NOLOCK)
ON a.idx = b.guildIDX
WHERE a.idx < @idx
ORDER BY a.idx DESC
GO
USE [LosaGame]
GO
-- game_friend_list_asc names this index in a table hint; the 2012 table does not have it.
IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE name='idx_userAccIDX' AND object_id=OBJECT_ID('dbo.userFriendDB'))
CREATE CLUSTERED INDEX idx_userAccIDX ON dbo.userFriendDB (userAccIDX)
GO
File diff suppressed because it is too large. Load diff
+21
View File
@@ -0,0 +1,21 @@
-- First regular tournament (Faction War / LS Cup panel). The main server only continues a row that exists;
-- nothing creates the first one. leagueType 1 = TYPE_REGULAR, leagueState 1 = STATE_TEAM_APP, accountIDX 0 = no owner.
-- Dates are YYMMDDHHMM in a DWORD (Help::ConvertCTimeToDate). Since 2022 that is above the int range, so the
-- int columns hold the wrapped value; the server reads the same bits back as a DWORD.
-- Starts on the last Monday 03:00 and runs next_tournament_hour (336) hours, like sp2_tournament_regular.ini.
USE [LosaGame]
GO
IF NOT EXISTS (SELECT 1 FROM dbo.userLeagueListDB WHERE leagueType = 1)
BEGIN
DECLARE @s datetime, @e datetime, @a bigint, @b bigint
SET @s = DATEADD(hour, 3, DATEADD(day, -(DATEDIFF(day, 0, GETDATE()) % 7), DATEDIFF(day, 0, GETDATE())))
SET @e = DATEADD(hour, 336, @s)
SET @a = CAST(YEAR(@s) % 100 AS bigint) * 100000000 + MONTH(@s) * 1000000 + DAY(@s) * 10000 + DATEPART(hour, @s) * 100
SET @b = CAST(YEAR(@e) % 100 AS bigint) * 100000000 + MONTH(@e) * 1000000 + DAY(@e) * 10000 + DATEPART(hour, @e) * 100
IF @a > 2147483647 SET @a = @a - 4294967296
IF @b > 2147483647 SET @b = @b - 4294967296
INSERT INTO dbo.userLeagueListDB (accountIDX, startDate, endDate, leagueType, leagueState, regDate)
VALUES (0, @a, @b, 1, 1, GETDATE())
END
SELECT idx, startDate, endDate, leagueType, leagueState FROM dbo.userLeagueListDB
GO
+174
View File
@@ -0,0 +1,174 @@
-- LosaDev 2014 testbed: 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 ('lsdevhub2014key', 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
-- LosaDev 2014 testbed: procedures whose 2012 parameter list is shorter than what the 2014 game server sends
-- ("has too many arguments specified"). The extra parameters get defaults; behaviour otherwise unchanged.
USE [LosaGame];
GO
-- query 22: the 2014 server pages the gear list (last index, account, page size)
ALTER PROCEDURE [dbo].[game_item_extra_get_list]
(
@lastIndex int
, @accountIDX int = 0
, @pageSize int = 0
)
AS
SET NOCOUNT ON
SELECT TOP (CASE WHEN @pageSize > 0 THEN @pageSize ELSE 2147483647 END) idx
, item1_type, item1_reinforce, item1_slotindex, item1_tradetype, item1_limitType, item1_mcustom, item1_fcustom, item1_limitDate
, item2_type, item2_reinforce, item2_slotindex, item2_tradetype, item2_limitType, item2_mcustom, item2_fcustom, item2_limitDate
, item3_type, item3_reinforce, item3_slotindex, item3_tradetype, item3_limitType, item3_mcustom, item3_fcustom, item3_limitDate
, item4_type, item4_reinforce, item4_slotindex, item4_tradetype, item4_limitType, item4_mcustom, item4_fcustom, item4_limitDate
, item5_type, item5_reinforce, item5_slotindex, item5_tradetype, item5_limitType, item5_mcustom, item5_fcustom, item5_limitDate
, item6_type, item6_reinforce, item6_slotindex, item6_tradetype, item6_limitType, item6_mcustom, item6_fcustom, item6_limitDate
, item7_type, item7_reinforce, item7_slotindex, item7_tradetype, item7_limitType, item7_mcustom, item7_fcustom, item7_limitDate
, item8_type, item8_reinforce, item8_slotindex, item8_tradetype, item8_limitType, item8_mcustom, item8_fcustom, item8_limitDate
, item9_type, item9_reinforce, item9_slotindex, item9_tradetype, item9_limitType, item9_mcustom, item9_fcustom, item9_limitDate
, item10_type, item10_reinforce, item10_slotindex, item10_tradetype, item10_limitType, item10_mcustom, item10_fcustom, item10_limitDate
FROM userItemExtraDB WHERE accountIDX = @accountIDX AND idx > @lastIndex ORDER BY idx
GO
-- query 26: same paging for the decoration item list (last index, account, page size)
ALTER PROCEDURE [dbo].[game_item_get_data_list]
(
@lastIndex int
, @accountIDX int = 0
, @pageSize int = 0
)
AS
SET NOCOUNT ON
SELECT TOP (CASE WHEN @pageSize > 0 THEN @pageSize ELSE 2147483647 END)
idx, item1_type, item1_code, item2_type, item2_code, item3_type, item3_code,
item4_type, item4_code, item5_type, item5_code, item6_type, item6_code,
item7_type, item7_code, item8_type, item8_code, item9_type, item9_code,
item10_type, item10_code, item11_type, item11_code, item12_type, item12_code,
item13_type, item13_code, item14_type, item14_code, item15_type, item15_code,
item16_type, item16_code, item17_type, item17_code, item18_type, item18_code,
item19_type, item19_code, item20_type, item20_code
FROM userItemDB WHERE accountIDX = @accountIDX AND idx > @lastIndex ORDER BY idx
GO
-- query 12: the 2014 server adds the relative grade init code as 15th value (not stored here)
ALTER PROCEDURE [dbo].[game_game_save]
(
@accountIDX int
, @userState int
, @gameMoney bigint
, @conn_count int
, @connDate datetime
, @userLevel int
, @userEXP int
, @playTime int
, @regionType int
, @userFishingLevel int
, @userFishingEXP int
, @refillData int
, @userExcavationLevel int
, @userExcavationEXP int
, @relativeInitCode int = 0
)
AS
UPDATE userGameDB SET
gameMoney = @gameMoney
, userState = @userState
, playTime = playTime + Round((@playTime/1000)/60,0)
, conn_count = @conn_count
, userLevel = @userLevel
, userEXP = @userEXP
, userFishingLevel = @userFishingLevel
, userFishingEXP = @userFishingEXP
, regionType = @regionType
, connDate = @connDate
, refillData = @refillData
, userExcavationLevel = @userExcavationLevel
, userExcavationEXP = @userExcavationEXP
WHERE accountIDX = @accountIDX
GO
-- Test heroes for the three test accounts. A new account owns no hero, so the game opens with a
-- "no hero available" popup. Six permanent heroes each (limitType 1 = CPT_MORTMAIN). Class 6, Savage
-- Berserker, comes first and is the leader (leaderType 1): the headquarters tutorial is written for
-- that hero and gets stuck with another one. Same columns as game_character_add. Safe to run
-- again: accounts that already own a hero are skipped.
USE [LosaGame]
GO
DECLARE @acc int
DECLARE acc CURSOR LOCAL FAST_FORWARD FOR
SELECT accountIDX FROM dbo.userMemberDB m
WHERE m.userID IN ('test1', 'test2', 'gmtest1')
AND NOT EXISTS (SELECT 1 FROM dbo.userCharacterDB c WHERE c.accountIDX = m.accountIDX)
OPEN acc
FETCH NEXT FROM acc INTO @acc
WHILE @@FETCH_STATUS = 0
BEGIN
INSERT INTO dbo.userCharacterDB (accountIDX, ClassType, CI_type, CI_gender, CI_beard, CI_face, CI_hair, CI_skinColor, CI_hairColor, CI_trinket, CI_underwear, CI_position, EI1_type, EI2_type, EI3_type, EI4_type, limitTime, limitType, leaderType, rentalType, rentalTime)
SELECT @acc, h.class, 1, 1, 1, 1, 1, 1, 1, 1, 1, h.pos, 0, 0, 0, 0, 0, 1, CASE WHEN h.class = 6 THEN 1 ELSE 0 END, 0, 0
FROM (VALUES (6, 0), (1, 1), (2, 2), (3, 3), (4, 4), (5, 5)) AS h(class, pos)
ORDER BY h.pos
-- Tutorial set = class type * 100 (User::_OnLeaderCreate). Skills only count when the hero's gear
-- set matches it, so the tutorial must be the Savage set.
UPDATE dbo.userGameDB SET userState = 600 WHERE accountIDX = @acc
FETCH NEXT FROM acc INTO @acc
END
CLOSE acc
DEALLOCATE acc
SELECT m.userID, COUNT(c.idx) AS heroes FROM dbo.userMemberDB m LEFT JOIN dbo.userCharacterDB c ON c.accountIDX = m.accountIDX GROUP BY m.userID
GO