Files

30 lines
1.7 KiB
Transact-SQL

-- 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