搜索
 找回密码
 加入

再要一个角色转换职业的存储,发下,发下.

talkweb 2009-11-24 19:10:14 1197
再要一个角色转换职业的存储,发下,发下.
再要一个角色转换职业的存储,发下,发下.

最好还能来个删除角色的存储.哈哈...

感谢了..

2 回复

ctgwglzc
2009-11-18 21:45:45
点击查看详情
  1. CREATE PROCEDURE [dbo].[DELETE_CHAR]
  2. @AccountID        char(21),
  3. @index                tinyint,
  4. @nation_id        tinyint,
  5. @CharID        char(21),
  6. @SocNo        char(17),
  7. @nKnightsIndex  smallint OUTPUT,
  8. @nRet                 smallint OUTPUT
  9. AS
  10. DECLARE @bCharNum        tinyint, @charid1 char(21), @charid2 char(21), @charid3 char(21), @charid4 char(21), @charid5 char(21), @strSocNo char(17)
  11. DECLARE @knightsindex smallint
  12. DECLARE @ForbidFreeTime smalldatetime  -- inserted by ZhiChang Peng 204-07-13
  13.         SET @bCharNum = 0
  14.         SET @knightsindex = 0
  15.         SET @nKnightsIndex = 0
  16.         SET @ForbidFreeTime = '2000-01-01 00:00:00'

  17. SELECT @ForbidFreeTime = ForbidFreeTime FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID
  18. IF @ForbidFreeTime > GETDATE()
  19. BEGIN
  20.         SET @nRet = -1
  21.         RETURN
  22. END
  23. -- inserted by brad 2004.2.17
  24. SELECT @strSocNo = strWarehousePW FROM WAREHOUSE WHERE strAccountID = @AccountID
  25. IF @strSocNo <> @SocNo
  26. BEGIN
  27.         SET @nRet = -1
  28.         RETURN
  29. END
  30. IF @nation_id <> 3        -- china
  31. BEGIN
  32.         SELECT @strSocNo = strSocNo FROM [Knight_Account].[dbo].[TB_USER] WHERE strAccountID = @AccountID
  33.         IF @SocNo <> @strSocNo
  34.         BEGIN
  35.                 SET @nRet = -1
  36.                 RETURN
  37.         END
  38. END
  39. SELECT * FROM  [Knight_Account].[dbo].[CURRENTUSER] WHERE strAccountID = @AccountID
  40. IF @@ROWCOUNT <> 0
  41. BEGIN
  42.         SET @nRet = -2
  43.         RETURN
  44. END
  45. -- inserted by samma 2003.07.10
  46. DECLARE @True smallint
  47. SET @True = 0
  48.         SELECT @charid1 = strCharID1, @charid2 = strCharID2, @charid3 = strCharID3 FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID
  49.         IF @CharID = @charid1 or @CharID = @charid2 or @CharID = @charid3
  50.                 SET @True = 1
  51.         IF @True = 0
  52.         BEGIN
  53.                 SET @nRet = 1
  54.                 RETURN
  55.         END
  56. -- inserted by samma 2003.07.10
  57. DECLARE        @Nation tinyint, @Race        tinyint, @Class        smallint, @HairColor tinyint, @Rank tinyint, @Title        tinyint, @Level tinyint, @Exp int, @Loyalty int
  58. DECLARE        @Face        tinyint, @City tinyint, @Knights        smallint, @Fame tinyint,        @Hp smallint, @Mp smallint,  @Sp smallint, @Strong tinyint, @Sta tinyint, @Dex tinyint
  59. 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
  60. DECLARE          @Members smallint
  61. 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
  62. BEGIN TRAN
  63.         IF @index = 0
  64.                 UPDATE ACCOUNT_CHAR SET strCHARID1 = NULL, bCharNum = bCharNum - 1 WHERE strAccountID = @AccountID
  65.         IF @index = 1
  66.                 UPDATE ACCOUNT_CHAR SET strCHARID2 = NULL, bCharNum = bCharNum - 1 WHERE strAccountID = @AccountID
  67.         IF @index = 2
  68.                 UPDATE ACCOUNT_CHAR SET strCHARID3 = NULL, bCharNum = bCharNum - 1 WHERE strAccountID = @AccountID
  69.         IF @index = 3
  70.                 UPDATE ACCOUNT_CHAR SET strCHARID4 = NULL, bCharNum = bCharNum - 1 WHERE strAccountID = @AccountID
  71.         IF @index = 4
  72.                 UPDATE ACCOUNT_CHAR SET strCHARID5 = NULL, bCharNum = bCharNum - 1 WHERE strAccountID = @AccountID
  73.         IF @@ERROR <> 0
  74.         BEGIN
  75.                 ROLLBACK TRAN
  76.                 SET @nRet = -2
  77.                 RETURN
  78.         END
  79.         SELECT @charid1 = strCHARID1, @charid2 = strCHARID2, @charid3 = strCHARID3, @charid4 = strCHARID4, @charid5 = strCHARID5 FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID
  80.         IF @charid1 = NULL and @charid2 = NULL and @charid3 = NULL and @charid4 = NULL and @charid5 = NULL          -- ???? ??? ??? ?? ???? ???.. -> ???? ?? ?? ??
  81.         BEGIN
  82.                 DELETE FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID
  83.                 IF @@ERROR <> 0
  84.                 BEGIN
  85.                         ROLLBACK TRAN
  86.                         SET @nRet = -2
  87.                         RETURN
  88.                 END
  89.         END
  90. -- modify by zxujie  03.09.17
  91.         SELECT @Nation = Nation, @Race = Race, @Class = Class, @HairColor = HairColor, @Rank = Rank, @Title = Title, @Level = [Level], @Exp = [Exp], @Loyalty = Loyalty, @Face = Face, @City = City, @Knights = Knights, @Fame = Fame,
  92.                  @Hp = Hp, @Mp = Mp, @Sp = Sp, @Strong = Strong, @Sta = Sta, @Dex = Dex, @Intel = Intel, @Cha = Cha, @Authority = Authority, @Points = Points, @Gold = Gold, @Zone = [Zone], @Bind = Bind, @PX = PX, @PZ = PZ, @PY = PY, @strSkill = strSkill, @strItem = strItem, @strSerial = strSerial, @sQuestCount = sQuestCount, @strQuest = strQuest, @MannerPoint = MannerPoint, @LoyaltyMonthly = LoyaltyMonthly
  93.         FROM        USERDATA WHERE strUserId = @CharID
  94.         INSERT INTO DELETED_USERDATA (strAccountID, strUserID, 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)
  95.         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 )
  96. -- modify by zxujie  03.09.17
  97.         DELETE FROM USERDATA WHERE strUserId = @CharID
  98.         IF @@ERROR <> 0
  99.         BEGIN
  100.                 ROLLBACK TRAN
  101.                 SET @nRet = -2
  102.                 RETURN
  103.         END
  104.         DELETE FROM KNIGHTS_USER WHERE strUserId = @CharID
  105.         SELECT @Members=Members FROM KNIGHTS WHERE IDNum = @Knights
  106.         IF @Members <= 1
  107.                 UPDATE KNIGHTS SET Members = 1 WHERE IDNum = @Knights
  108.         ELSE
  109.                 UPDATE KNIGHTS SET Members = Members - 1 WHERE IDNum = @Knights
  110. COMMIT TRAN
  111. SET @nKnightsIndex  = @Knights
  112. SET @nRet = 1

  113. GO
复制代码
214550663
2009-11-24 19:10:14
CT,能否解释下呀?
高级模式
游客