1311 人物删除存储
USEGO
/****** Object: StoredProcedure . Script Date: 06/25/2009 14:33:20 ******/
SET ANSI_NULLS ON GO
SET QUOTED_IDENTIFIER ON GO
CREATE PROCEDURE .
@AccountID char(21),
@index tinyint,
@CharID char(21),
@SocNo char(15),
@nRet smallint OUTPUT
AS DECLARE @bCharNum tinyint, @charid1 char(21), @charid2 char(21), @charid3 char(21), @charid4 char(21), @charid5 char(21), @strSocNo char(15)
DECLARE @knightsindex smallint
SET @bCharNum = 0
SET @knightsindex = 0
SELECT @strSocNo = strSocNo FROM TB_USER WHERE strAccountID = @AccountID
IF @SocNo <> @strSocNo
BEGIN SET @nRet = 0
RETURN
END
DECLARE @Nation tinyint, @Race tinyint, @Class smallint, @HairColor tinyint, @Rank tinyint, @Title tinyint, @Level tinyint, @Exp int, @Loyalty int
DECLARE @Face tinyint, @City tinyint, @Knights smallint, @Fame tinyint, @Hp smallint, @Mp smallint, @Sp smallint, @Strong tinyint, @Sta tinyint, @Dex tinyint
DECLARE @Intel tinyint, @Cha tinyint, @Authority tinyint, @Points tinyint, @Gold int, @Zone smallint, @Bind smallint, @PX int, @PZ int, @PY int, @strSkill varchar(20), @strItem varchar(400)
DECLARE @Members smallint
BEGIN TRAN
IF @index = 0
UPDATE ACCOUNT_CHAR SET strCHARID1 = NULL, bCharNum = bCharNum - 1 WHERE strAccountID = @AccountID
IF @index = 1
UPDATE ACCOUNT_CHAR SET strCHARID2 = NULL, bCharNum = bCharNum - 1 WHERE strAccountID = @AccountID
IF @index = 2
UPDATE ACCOUNT_CHAR SET strCHARID3 = NULL, bCharNum = bCharNum - 1 WHERE strAccountID = @AccountID
IF @index = 3
UPDATE ACCOUNT_CHAR SET strCHARID4 = NULL, bCharNum = bCharNum - 1 WHERE strAccountID = @AccountID
IF @index = 4
UPDATE ACCOUNT_CHAR SET strCHARID5 = NULL, bCharNum = bCharNum - 1 WHERE strAccountID = @AccountID
IF @@ERROR <> 0
BEGIN ROLLBACK TRAN
SET @nRet = 0
RETURN
END
SELECT @charid1 = strCHARID1, @charid2 = strCHARID2, @charid3 = strCHARID3, @charid4 = strCHARID4, @charid5 = strCHARID5 FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID
IF @charid1 = NULL and @charid2 = NULL and @charid3 = NULL and @charid4 = NULL and @charid5 = NULL -- ???? ??? ??? ?? ???? ???.. -> ???? ?? ?? ??
BEGIN DELETE FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID
IF @@ERROR <> 0
BEGIN ROLLBACK TRAN
SET @nRet = 0
RETURN
END
END
SELECT @Nation = Nation, @Race = Race, @Class = Class, @HairColor = HairColor, @Rank = Rank, @Title = Title, @Level = , @Exp = , @Loyalty = Loyalty, @Face = Face, @City = City, @Knights = Knights, @Fame = Fame,
@Hp = Hp, @Mp = Mp, @Sp = Sp, @Strong = Strong, @Sta = Sta, @Dex = Dex, @Intel = Intel, @Cha = Cha, @Authority = Authority, @Points = Points, @Gold = Gold, @Zone = , @Bind = Bind, @PX = PX, @PZ = PZ, @PY = PY, @strSkill = strSkill, @strItem = strItem
FROM USERDATA WHERE strUserId = @CharID
INSERT INTO DELETED_USERDATA (strAccountID, strUserID, Nation, Race, Class, HairColor, Rank, Title, , , Loyalty, Face, City, Knights, Fame, Hp, Mp, Sp, Strong, Sta, Dex, Intel, Cha, Authority, Points, Gold, , Bind, PX, PZ, PY, strSkill, strItem )
VALUES ( @AccountID, @CharID, @Nation, @Race, @Class, @HairColor, @Rank, @Title, @Level, @Exp, @Loyalty, @Face, @City, @Knights, @Fame, @Hp, @Mp, @Sp, @Strong, @Sta, @Dex, @Intel, @Cha, @Authority, @Points, @Gold, @Zone, @Bind, @PX, @PZ, @PY, @strSkill, @strItem )
DELETE FROM USERDATA WHERE strUserId = @CharID
IF @@ERROR <> 0
BEGIN ROLLBACK TRAN
SET @nRet = 0
RETURN
END
DELETE FROM KNIGHTS_USER WHERE strUserId = @CharID
SELECT @Members=Members FROM KNIGHTS WHERE IDNum = @Knights
IF @Members <= 1
UPDATE KNIGHTS SET Members = 1 WHERE IDNum = @Knights
ELSE
UPDATE KNIGHTS SET Members = Members - 1 WHERE IDNum = @Knights
COMMIT TRAN
SET @nRet = 1
GO 干嘛的 路过,支持了 路過的~~~推~ 日後學 猪头的服都倒了
wery0712 发表于 2009-10-26 15:43 http://www.kofans.cn/bbs/static/image/common/back.gif
就你小子会钻空子,哈
正版删除程式
****** ??: ?? ???? dbo.DELETE_CHAR ???? ??: 2002-11-14 ?? 11:18:03 ******/-- Scripted by Samma
-- 2002.01.18
-- 2002.08.19 Modified by samma because check social number
-- 2002.10.11 Modified by Sungyongbecause knights, knights_user table modify
-- 2002 11.21 samma
-- 2002. 12.24 sungyong
-- 2004-07-13 modified by ZhiChang Peng
-- 2004-09-10 modified by ZhiChang Peng
CREATE PROCEDURE .
@AccountID char(21),
@index tinyint,
@nation_id tinyint,
@CharID char(21),
@SocNo char(17),
@nKnightsIndexsmallint OUTPUT,
@nRet smallint OUTPUT
AS
DECLARE @bCharNum tinyint, @charid1 char(21), @charid2 char(21), @charid3 char(21), @charid4 char(21), @charid5 char(21), @strSocNo char(17)
DECLARE @knightsindex smallint
DECLARE @ForbidFreeTime smalldatetime-- inserted by ZhiChang Peng 204-07-13
SET @bCharNum = 0
SET @knightsindex = 0
SET @nKnightsIndex = 0
SET @ForbidFreeTime = '2000-01-01 00:00:00'
-- inserted by ZhiChang Peng 2004-07-13
-- 禁止玩家删除被临时或者永久停权的帐号中的角色
SELECT @ForbidFreeTime = ForbidFreeTime FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID
IF @ForbidFreeTime > GETDATE()
BEGIN
SET @nRet = -1
RETURN
END
-- inserted by brad 2004.2.17
SELECT @strSocNo = strWarehousePW FROM WAREHOUSE WHERE strAccountID = @AccountID
IF @strSocNo <> @SocNo
BEGIN
SET @nRet = -1
RETURN
END
IF @nation_id <> 3 -- china
BEGIN
SELECT @strSocNo = strSocNo FROM .. WHERE strAccountID = @AccountID
IF @SocNo <> @strSocNo
BEGIN
SET @nRet = -1
RETURN
END
END
SELECT * FROM.. WHERE strAccountID = @AccountID
IF @@ROWCOUNT <> 0
BEGIN
SET @nRet = -2
RETURN
END
-- inserted by samma 2003.07.10
DECLARE @True smallint
SET @True = 0
SELECT @charid1 = strCharID1, @charid2 = strCharID2, @charid3 = strCharID3 FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID
IF @CharID = @charid1 or @CharID = @charid2 or @CharID = @charid3
SET @True = 1
IF @True = 0
BEGIN
SET @nRet = 1
RETURN
END
-- inserted by samma 2003.07.10
DECLARE @Nation tinyint, @Race tinyint, @Class smallint, @HairColor tinyint, @Rank tinyint, @Title tinyint, @Level tinyint, @Exp int, @Loyalty int
DECLARE @Face tinyint, @City tinyint, @Knights smallint, @Fame tinyint, @Hp smallint, @Mp smallint,@Sp smallint, @Strong tinyint, @Sta tinyint, @Dex tinyint
DECLARE @Intel tinyint, @Cha tinyint, @Authority tinyint, @Points tinyint, @Gold int, @Zone tinyint, @Bind smallint, @PX int, @PZ int, @PY int, @strSkill varchar(20), @strItem varchar(400), @strSerial varchar(400) -- @strSerial added by ZhiChang Peng 2004-09-10
DECLARE @Members smallint
DECLARE @sQuestCount smallint, @strQuest varchar(400), @MannerPoint int, @LoyaltyMonthly int-- add by zxujie 03.09.17,MannerPoint added by pengzc 040323, LoyaltyMonthly added by pengzc 040529
BEGIN TRAN
IF @index = 0
UPDATE ACCOUNT_CHAR SET strCHARID1 = NULL, bCharNum = bCharNum - 1 WHERE strAccountID = @AccountID
IF @index = 1
UPDATE ACCOUNT_CHAR SET strCHARID2 = NULL, bCharNum = bCharNum - 1 WHERE strAccountID = @AccountID
IF @index = 2
UPDATE ACCOUNT_CHAR SET strCHARID3 = NULL, bCharNum = bCharNum - 1 WHERE strAccountID = @AccountID
IF @index = 3
UPDATE ACCOUNT_CHAR SET strCHARID4 = NULL, bCharNum = bCharNum - 1 WHERE strAccountID = @AccountID
IF @index = 4
UPDATE ACCOUNT_CHAR SET strCHARID5 = NULL, bCharNum = bCharNum - 1 WHERE strAccountID = @AccountID
IF @@ERROR <> 0
BEGIN
ROLLBACK TRAN
SET @nRet = -2
RETURN
END
SELECT @charid1 = strCHARID1, @charid2 = strCHARID2, @charid3 = strCHARID3, @charid4 = strCHARID4, @charid5 = strCHARID5 FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID
IF @charid1 = NULL and @charid2 = NULL and @charid3 = NULL and @charid4 = NULL and @charid5 = NULL -- ???? ??? ??? ?? ???? ???.. -> ???? ?? ?? ??
BEGIN
DELETE FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID
IF @@ERROR <> 0
BEGIN
ROLLBACK TRAN
SET @nRet = -2
RETURN
END
END
-- modify by zxujie03.09.17
SELECT @Nation = Nation, @Race = Race, @Class = Class, @HairColor = HairColor, @Rank = Rank, @Title = Title, @Level = , @Exp = , @Loyalty = Loyalty, @Face = Face, @City = City, @Knights = Knights, @Fame = Fame,
@Hp = Hp, @Mp = Mp, @Sp = Sp, @Strong = Strong, @Sta = Sta, @Dex = Dex, @Intel = Intel, @Cha = Cha, @Authority = Authority, @Points = Points, @Gold = Gold, @Zone = , @Bind = Bind, @PX = PX, @PZ = PZ, @PY = PY, @strSkill = strSkill, @strItem = strItem, @strSerial = strSerial, @sQuestCount = sQuestCount, @strQuest = strQuest, @MannerPoint = MannerPoint, @LoyaltyMonthly = LoyaltyMonthly
FROM USERDATA WHERE strUserId = @CharID
INSERT INTO DELETED_USERDATA (strAccountID, strUserID, Nation, Race, Class, HairColor, Rank, Title, , , Loyalty, Face, City, Knights, Fame, Hp, Mp, Sp, Strong, Sta, Dex, Intel, Cha, Authority, Points, Gold, , Bind, PX, PZ, PY, strSkill, strItem, strSerial, sQuestCount, strQuest, MannerPoint, LoyaltyMonthly)
VALUES ( @AccountID, @CharID, @Nation, @Race, @Class, @HairColor, @Rank, @Title, @Level, @Exp, @Loyalty, @Face, @City, @Knights, @Fame, @Hp, @Mp, @Sp, @Strong, @Sta, @Dex, @Intel, @Cha, @Authority, @Points, @Gold, @Zone, @Bind, @PX, @PZ, @PY, @strSkill, @strItem, @strSerial, @sQuestCount, @strQuest, @MannerPoint, @LoyaltyMonthly )
-- modify by zxujie03.09.17
DELETE FROM USERDATA WHERE strUserId = @CharID
IF @@ERROR <> 0
BEGIN
ROLLBACK TRAN
SET @nRet = -2
RETURN
END
DELETE FROM KNIGHTS_USER WHERE strUserId = @CharID
SELECT @Members=Members FROM KNIGHTS WHERE IDNum = @Knights
IF @Members <= 1
UPDATE KNIGHTS SET Members = 1 WHERE IDNum = @Knights
ELSE
UPDATE KNIGHTS SET Members = Members - 1 WHERE IDNum = @Knights
COMMIT TRAN
SET @nKnightsIndex= @Knights
SET @nRet = 1
GO {:1_215:} 是真的吗????
页:
[1]