搜索
 找回密码
 加入

自动分配角色的创建存储

ctgwglzc 2010-2-4 15:45:15 1294
  1. CREATE PROCEDURE CREATE_NEW_CHAR

  2. @nRet smallint OUTPUT,
  3. @AccountID char(21),
  4. @index tinyint,
  5. @CharID char(21),
  6. @Race tinyint,
  7. @Class smallint,
  8. @Hair tinyint,
  9. @Face tinyint,
  10. @Str tinyint,
  11. @Sta tinyint,
  12. @Dex tinyint,
  13. @Intel tinyint,
  14. @Cha tinyint

  15. AS

  16. DECLARE @Row tinyint, @Nation tinyint, @Zone tinyint, @PosX int, @PosZ int
  17. SET @Row = 0 SET @Nation = 0 SET @Zone = 0 SET @PosX = 0 SET @PosZ = 0

  18. SELECT @Nation = bNation, @Row = bCharNum FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID

  19. IF @Row >= 5 SET @nRet = 1

  20. IF @Nation = 1 AND @Race > 10 SET @nRet = 2
  21. ELSE IF @Nation = 2 AND @Race < 10 SET @nRet = 2
  22. ELSE IF @Nation <>1 AND @Nation <> 2 SET @nRet = 2

  23. IF @nRet > 0
  24. RETURN

  25. SELECT @Row = COUNT(*) FROM USERDATA WHERE strUserId = @CharID
  26. IF @Row > 0
  27. BEGIN
  28. SET @nRet = 3
  29. RETURN
  30. END


  31. SET @Zone=21
  32. SELECT @PosX = InitX, @PosZ = InitZ FROM ZONE_INFO WHERE ZoneNo = @Zone

  33. select @row = 3
  34. if @CharID like '%___%'
  35. if @CharID like '%_%'
  36. if @CharID like '%__%'
  37. if @CharID like '%:%'
  38. if @CharID like '%::%'
  39. begin
  40. SET @nRet = 3
  41. RETURN


  42. END
  43. BEGIN TRAN
  44. IF @index = 0
  45. UPDATE ACCOUNT_CHAR SET strCharID1 = @CharID, bCharNum = bCharNum + 1 WHERE strAccountID = @AccountID
  46. ELSE IF @index = 1
  47. UPDATE ACCOUNT_CHAR SET strCharID2 = @CharID, bCharNum = bCharNum + 1 WHERE strAccountID = @AccountID
  48. ELSE IF @index = 2
  49. UPDATE ACCOUNT_CHAR SET strCharID3 = @CharID, bCharNum = bCharNum + 1 WHERE strAccountID = @AccountID
  50. ELSE IF @index = 3
  51. UPDATE ACCOUNT_CHAR SET strCharID4 = @CharID, bCharNum = bCharNum + 1 WHERE strAccountID = @AccountID
  52. ELSE IF @index = 4
  53. UPDATE ACCOUNT_CHAR SET strCharID5 = @CharID, bCharNum = bCharNum + 1 WHERE strAccountID = @AccountID


  54. INSERT INTO USERDATA (strUserId, Nation, Race, Class, HairColor, Face, Strong, Sta, Dex, Intel, Cha, Zone, PX, PZ )
  55. VALUES (@CharID, @Nation, @Race, @Class, @Hair, @Face, @Str, @Sta, @Dex, @Intel, @Cha, @Zone, @PosX, @PosZ )


  56. exec baslangicitem @CharID
  57. update userdata set Class = 106 , strong = '255' , sta = '180' ,strskill = '?????P<???' , [level] = '83' , hp='5000' ,mp='5000' ,exp = '1' where struserid = @CharID and @Class = 101
  58. update userdata set Class = 108 , strong = '71' , dex = '255' , sta = '169' ,strskill ='P<' , [level] = '83' , hp ='5000' ,mp='5000' ,exp = '1' where struserid = @CharID and @Class = 102
  59. update userdata set Class = 110 , strong = '71' , sta = '100' , cha = '194' , intel = '162' ,strskill ='P<' , [level] = '83' , hp='5000' ,mp='5000' ,exp = '1' where struserid = @CharID and @Class = 103
  60. update userdata set Class = 112 , strong = '110' , sta = '120' , intel = '230' ,strskill ='P<' , [level] = '83' where struserid = @CharID and @Class = 104
  61. update userdata set Class = 206 , strong = '255' , sta = '180' ,strskill ='P<' , [level] = '83' , hp='5000' ,mp='5000' ,exp = '1' where struserid = @CharID and @Class = 201
  62. update userdata set Class = 208 , strong = '71' , dex = '255' , sta = '169' ,strskill ='P<' , [level] = '83' , hp='5000' ,mp='5000' ,exp = '1' where struserid = @CharID and @Class = 202
  63. update userdata set Class = 210 , strong = '71' , sta = '100' , cha = '194' , intel = '162' ,strskill ='P<' , [level] = '83' , hp='5000' ,mp='5000' ,exp = '1' where struserid = @CharID and @Class = 203
  64. update userdata set Class = 212 , strong = '110' , sta = '120' , intel = '230' ,strskill ='P<' , [level] = '83' , hp='5000' ,mp='5000' ,exp = '1' where struserid = @CharID and @Class = 204


  65. update userdata set Class = 106 where struserid = @CharID and @Class = 101
  66. update userdata set Class = 108 where struserid = @CharID and @Class = 102
  67. update userdata set Class = 110 where struserid = @CharID and @Class = 103
  68. update userdata set Class = 112 where struserid = @CharID and @Class = 104
  69. update userdata set Class = 206 where struserid = @CharID and @Class = 201
  70. update userdata set Class = 208 where struserid = @CharID and @Class = 202
  71. update userdata set Class = 210 where struserid = @CharID and @Class = 203
  72. update userdata set Class = 212 where struserid = @CharID and @Class = 204

  73. IF @@ERROR <> 0
  74. BEGIN
  75. ROLLBACK TRAN
  76. SET @nRet = 4
  77. RETURN
  78. END

  79. COMMIT TRAN
  80. SET @nRet = 0
  81. GO
复制代码

7 回复

v123
2009-9-28 20:41:58
点击查看详情
有什么用的,
leonjaykai
2009-12-3 20:34:21
這個是做什麼用的? 請教一下~~
aiiq
2009-12-4 16:41:50
介绍一下嘛
leonjaykai
2010-1-6 09:38:22
看樣子好像是自動分配角色能力點數的存儲似的 說
⑦埰媣汸
2010-1-8 12:16:38
自动分配能力点数的吗?
我现在的建立人物 还不让一个能力点加完 必须 各加5点。。。。
iko
2010-1-9 13:18:19
收下了,谢谢
oncewill
2010-2-4 15:45:15
收下先。。谢谢
高级模式
游客