server-re/decomp/schema/RustyHearts/procs/up_create_character.sql

118 lines
3.1 KiB
Transact-SQL

CREATE PROCEDURE [dbo].[up_create_character]
@bcust_id nvarchar(50),
@auth_id [uniqueidentifier],
@char_id [uniqueidentifier],
@name nvarchar(16),
@class int,
@server smallint,
@lobby_id int
as
begin
declare @get_AuthID [uniqueidentifier]
--declare @bcust_id nvarchar(50)
set @get_AuthID = NULL
set nocount on
--select @bcust_id = WindyCode from [RustyHeartsLinkAuth].[RustyHearts_Auth].[dbo].[AuthTable] with (READUNCOMMITTED) where AuthID = @auth_id;
BEGIN TRAN
declare @out_first_char int;
SET @out_first_char = 0;
select @get_AuthID = AuthID from KeyMapTable with (READUNCOMMITTED) where AuthID = @auth_id;
if( @get_AuthID IS NULL )
begin
SET @out_first_char = 255;
insert into KeyMapTable
values( @auth_id, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 );
end
-- 사용할수 있는 이름인지 체크.
if EXISTS (select character_id from CharacterTable with (READUNCOMMITTED) WHERE [Name] = @name)
begin
SET @out_first_char = -1;
select FIRST_CHARACTER = @out_first_char;
ROLLBACK TRAN
return;
end
insert into CharacterTable
values( @char_id, --character_id
@bcust_id,
@auth_id, --AuthID
@server, --server
@name, --Name
@class, --Class
0, --Job
1, --Level
0, --Experience
0, --Stamina
0, --SP
0, --Total_SP
1000, --Fatigue
@lobby_id, --LobbyID 엘마에서->상가로 변경
1, --StartPoint
0, --gold
4000000, --individual_roomID
NULL, --GuildID
GETDATE(), --CreateTime
GETDATE(), --LastLogin
10, --Coin
1, --first_login
1, --tutotial
0, --give_up
0, --Block_Type
'N', --Block_YN
'N', --IsConnect
0, --storage_gold
12, --storage_count
'Y', --IsTradeEnable
0, --Expire_Time
0, --event_fatigue
0, --event_hearts
0, --dice_point
0, --Addition_HP
0, --Addition_MP
0, --Addition_Physic_Attack
0, --Addition_Physic_Defense
0, --Addition_Magic_Attack
0, --Addition_Magic_Defense
0, --Permission
0, --FatigueStorage
0, --DayAttachGold
0, --DayAttachItem
0, --ReservedGuildPoint jojo
0, --event_fortune
1, --fortune
'N', --IsMoveEnable
0, --event_mailattach
0, --tutorial_step
0, --daypartymission
0, --event_daypartymission
0); --time_sp
exec [skill_learn_base] @char_id, @class
-- pvp 테이블 생성
insert into dbo.BattleInfo (character_id, char_class, duel_ladder_exp) values( @char_id, @class, 1000 );
select FIRST_CHARACTER = @out_first_char, * from CharacterTable with (READUNCOMMITTED) where character_id = @char_id;
declare @ERR int
SET @ERR = @@ERROR
IF @ERR <> 0 BEGIN
RAISERROR('처리오류', 16, 10)
IF @@TRANCOUNT <> 0
BEGIN
ROLLBACK TRAN
END
RETURN
END
COMMIT TRAN
end