|
Архивный участник
Join Date: May 2006
Posts: 32
|
Quote:
|
Originally Posted by archonus
If u use db , all ur new characters will start at level 1 with 10,000,000 adena , 10 Greater Haste Potion , 10 Swift Attack Potion, 50 Healing Potion , 50 Mana potion , 1000 blessed spiritshot Ng and 1000 soulshot Ng.
|
run query analyzer ...
Code:
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[lin_CreateChar]') and OBJECTPROPERTY(id, N'IsProcedure') = 1)
drop procedure [dbo].[lin_CreateChar]
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
/********************************************
lin_CreateChar
ALTER character sp
INPUT
@char_name NCHAR(12),
@account_name NCHAR(13),
@account_id INT,
@pledge_id INT,
@builder TINYINT,
Is builder or not. BOOL
@gender TINYINT,
@race TINYINT,
@class TINYINT,
@world SMALLINT,
@xloc INT,
@yloc INT,
@zloc INT,
@HP FLOAT,
Character's Remain Hit Point
@MP FLOAT,
Character's Remain Mana Point
@SP INT,
Character's Remain Skill Point
@Exp INT,
Experience Point
@Lev TINYINT,
Character Level
@align SMALLINT,
Alignment
@PK INT,
Number of PK
OUTPUT
char_id, @@IDENTITY
return
made by
carrot
date
2002-01-31
change
2002-05-22 carrot
check character name have space
20xx.xx.2 carrot
add nFaceIndex nHairShapeIndex nHairColorIndex
20xx.xx.18 carrot
add user_prohibit_word restrict
********************************************/
CREATE PROCEDURE [DBO].[lin_CreateChar]
(
@char_name NVARCHAR(24),
@account_name NVARCHAR(24),
@account_id INT,
@pledge_id INT,
@builder TINYINT,
@gender TINYINT,
@race TINYINT,
@class TINYINT,
@world SMALLINT,
@xloc INT,
@yloc INT,
@zloc INT,
@HP FLOAT,
@MP FLOAT,
@SP INT,
@Exp INT,
@Lev TINYINT,
@align SMALLINT,
@PK INT,
@Duel INT,
@PKPardon INT,
@FaceIndex INT = 0,
@HairShapeIndex INT = 0,
@HairColorIndex INT = 0
)
AS
SET NOCOUNT ON
---------------------------------------- ---------------------------------------- ---------------------------------------- ----------------------------------------
---------------------------------------- can not make character. begin
---------------------------------------- ---------------------------------------- ---------------------------------------- ----------------------------------------
-- RAISERROR ('Character create failed : name = [%s]', 16, 1, @char_name)
-- RETURN -1
---------------------------------------- ---------------------------------------- ---------------------------------------- ----------------------------------------
---------------------------------------- can not make character. end
---------------------------------------- ---------------------------------------- ---------------------------------------- ----------------------------------------
SET @char_name = RTRIM(@char_name)
DECLARE @char_id int
SET @char_id = 0
-- debug code delete in commercial
IF (GETDATE() < '2004-1-1')
SET @builder = 1
IF @char_name LIKE N' '
BEGIN
RAISERROR ('Character name has space : name = [%s]', 16, 1, @char_name)
RETURN -1
END
-- check user_prohibit
if exists(select char_name from user_prohibit (nolock) where char_name = @char_name)
begin
RAISERROR ('Character name is prohibited: name = [%s]', 16, 1, @char_name)
RETURN -1
end
declare @user_prohibit_word nvarchar(20)
select top 1 @user_prohibit_word = words from user_prohibit_word (nolock) where PATINDEX('%' + words + '%', @char_name) > 0
if @user_prohibit_word is not null
begin
RAISERROR ('Character name has prohibited word: name = [%s], word[%s]', 16, 1, @char_name, @user_prohibit_word)
RETURN -1
end
-- check reserved name
declare @reserved_name nvarchar(50)
declare @reserved_account_id int
select top 1 @reserved_name = char_name, @reserved_account_id = account_id from user_name_reserved (nolock) where used = 0 and char_name = @char_name
if not @reserved_name is null
begin
if not @reserved_account_id = @account_id
begin
RAISERROR ('Character name is reserved by other player: name = [%s]', 16, 1, @char_name)
RETURN -1
end
end
-- insert user_data
INSERT INTO user_data
( char_name, account_name, account_id, pledge_id, builder, gender, race, class,
world, xloc, yloc, zloc, HP, MP, max_hp, max_mp, SP, Exp, Lev, align, PK, PKpardon, duel, create_date, face_index, hair_shape_index, hair_color_index )
VALUES
(@char_name, @account_name, @account_id, @pledge_id, @builder, @gender, @race, @class,
@world, @xloc, @yloc, @zloc, @HP, @MP, @HP, @MP, @SP, @Exp, @Lev, @align, @PK, @Duel, @PKPardon, GETDATE(), @FaceIndex, @HairShapeIndex, @HairColorIndex)
IF (@@error = 0)
BEGIN
SET @char_id = @@IDENTITY
INSERT INTO quest (char_id) VALUES (@char_id)
END
SELECT @char_id
if @char_id > 0
begin
-- make user_history
exec lin_InsertUserHistory @char_name, @char_id, 1, @account_name, NULL
if not @reserved_name is null
update user_name_reserved set used = 1 where char_name = @reserved_name
INSERT INTO user_item
(user_item.char_id,user_item. item_type, user_item.amount, user_item.enchant, user_item.eroded,user_item. bless,user_item. ident,user_item. wished,user_item. warehouse)
VALUES
(@char_id, '57', '1' , '0', '0', '0', '0', '0', '0')
end
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
|