Guest User

Untitled

a guest
Nov 24th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.18 KB | None | 0 0
  1. USE [KN_online]
  2. GO
  3. /****** Object: StoredProcedure [dbo].[CREATE_NEW_CHAR] Script Date: 05/31/2011 16:35:28 ******/
  4. SET ANSI_NULLS ON
  5. GO
  6. SET QUOTED_IDENTIFIER ON
  7. GO
  8. /****** Object: StoredProcedure [dbo].[CREATE_NEW_CHAR] Script Date: 05/31/2011 16:22:03 ******/
  9.  
  10. -- Scripted by mortal
  11. -- modified 31.5 2011
  12.  
  13. ALTER PROCEDURE [dbo].[CREATE_NEW_CHAR]
  14.  
  15. @nRet smallint OUTPUT,
  16. @AccountID char(21),
  17. @index tinyint,
  18. @CharID char(21),
  19. @Race tinyint,
  20. @Class smallint,
  21. @Hair tinyint,
  22. @Face tinyint,
  23. @Str tinyint,
  24. @Sta tinyint,
  25. @Dex tinyint,
  26. @Intel tinyint,
  27. @Cha tinyint,
  28. @strItem varchar(400)
  29.  
  30.  
  31. AS
  32.  
  33. DECLARE @Row tinyint, @Nation tinyint, @Zone tinyint, @PosX int, @PosZ int
  34. SET @Row = 0 SET @Nation = 0 SET @Zone = 0 SET @PosX = 0 SET @PosZ = 0
  35.  
  36. SELECT @Nation = bNation, @Row = bCharNum FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID
  37.  
  38. IF @Row >= 5 SET @nRet = 1
  39.  
  40. IF @Nation = 1 AND @Race > 10 SET @nRet = 2
  41. ELSE IF @Nation = 2 AND @Race < 10 SET @nRet = 2
  42. ELSE IF @Nation <>1 AND @Nation <> 2 SET @nRet = 2
  43.  
  44. IF @nRet > 0
  45. RETURN
  46.  
  47. SELECT @Row = COUNT(*) FROM USERDATA WHERE strUserId = @CharID
  48. IF @Row > 0
  49. BEGIN
  50. SET @nRet = 3
  51. RETURN
  52. END
  53.  
  54.  
  55. SET @Zone=21
  56. SELECT @PosX = InitX, @PosZ = InitZ FROM ZONE_INFO WHERE ZoneNo = @Zone
  57.  
  58. select @row = 3
  59. if @CharID like '%___%'
  60. if @CharID like '%_%'
  61. if @CharID like '%__%'
  62. if @CharID like '%:%'
  63. if @CharID like '%::%'
  64. begin
  65. SET @nRet = 3
  66. RETURN
  67.  
  68.  
  69. END
  70. BEGIN TRAN
  71. IF @index = 0
  72. UPDATE ACCOUNT_CHAR SET strCharID1 = @CharID, bCharNum = bCharNum + 1 WHERE strAccountID = @AccountID
  73. ELSE IF @index = 1
  74. UPDATE ACCOUNT_CHAR SET strCharID2 = @CharID, bCharNum = bCharNum + 1 WHERE strAccountID = @AccountID
  75. ELSE IF @index = 2
  76. UPDATE ACCOUNT_CHAR SET strCharID3 = @CharID, bCharNum = bCharNum + 1 WHERE strAccountID = @AccountID
  77. ELSE IF @index = 3
  78. UPDATE ACCOUNT_CHAR SET strCharID4 = @CharID, bCharNum = bCharNum + 1 WHERE strAccountID = @AccountID
  79. ELSE IF @index = 4
  80. UPDATE ACCOUNT_CHAR SET strCharID5 = @CharID, bCharNum = bCharNum + 1 WHERE strAccountID = @AccountID
  81.  
  82.  
  83. IF (@Class = 101 OR @Class = 201)
  84. BEGIN
  85. SELECT TOP 1 @strItem = strItem FROM USERDATA WHERE strUserId = 'Warrior'
  86. END
  87. ELSE IF (@Class = 102 OR @Class = 202)
  88. BEGIN
  89. SELECT TOP 1 @strItem = strItem FROM USERDATA WHERE strUserId = 'Rogue'
  90. END
  91. ELSE IF (@Class = 103 OR @Class = 203)
  92. BEGIN
  93. SELECT TOP 1 @strItem = strItem FROM USERDATA WHERE strUserId = 'Magician'
  94. END
  95. ELSE IF (@Class = 104 OR @Class = 204)
  96. BEGIN
  97. SELECT TOP 1 @strItem = strItem FROM USERDATA WHERE strUserId = 'Priest'
  98. END
  99.  
  100.  
  101. INSERT INTO USERDATA (strUserId, Nation, Race, Class, HairColor, Face, Strong, Sta, Dex, Intel, Cha, Zone, PX, PZ )
  102. VALUES (@CharID, @Nation, @Race, @Class, @Hair, @Face, @Str, @Sta, @Dex, @Intel, @Cha, @Zone, @PosX, @PosZ )
  103.  
  104.  
  105. exec baslangicitem @CharID
  106. update userdata set loyalty = '101' where struserid = @CharID
  107. update userdata set Class = 106 , strong = '255' , sta = '180' ,strskill = '?????P<???' , [level] = '80' , hp='5000' ,mp='5000' ,exp = '1' where struserid = @CharID and @Class = 101
  108. update userdata set Class = 108 , strong = '71' , dex = '255' , sta = '169' ,strskill ='P<' , [level] = '80' , hp ='5000' ,mp='5000' ,exp = '1' where struserid = @CharID and @Class = 102
  109. update userdata set Class = 110 , strong = '71' , sta = '100' , cha = '194' , intel = '162' ,strskill ='P<' , [level] = '80' , hp='5000' ,mp='5000' ,exp = '1' where struserid = @CharID and @Class = 103
  110. update userdata set Class = 112 , strong = '110' , sta = '120' , intel = '230' ,strskill ='P<' , [level] = '80' where struserid = @CharID and @Class = 104
  111. update userdata set Class = 206 , strong = '255' , sta = '180' ,strskill ='P<' , [level] = '80' , hp='5000' ,mp='5000' ,exp = '1' where struserid = @CharID and @Class = 201
  112. update userdata set Class = 208 , strong = '71' , dex = '255' , sta = '169' ,strskill ='P<' , [level] = '80' , hp='5000' ,mp='5000' ,exp = '1' where struserid = @CharID and @Class = 202
  113. update userdata set Class = 210 , strong = '71' , sta = '100' , cha = '194' , intel = '162' ,strskill ='P<' , [level] = '80' , hp='5000' ,mp='5000' ,exp = '1' where struserid = @CharID and @Class = 203
  114. update userdata set Class = 212 , strong = '110' , sta = '120' , intel = '230' ,strskill ='P<' , [level] = '80' , hp='5000' ,mp='5000' ,exp = '1' where struserid = @CharID and @Class = 204
  115.  
  116. update userdata set Class = 106 where struserid = @CharID and @Class = 101
  117. update userdata set Class = 108 where struserid = @CharID and @Class = 102
  118. update userdata set Class = 110 where struserid = @CharID and @Class = 103
  119. update userdata set Class = 112 where struserid = @CharID and @Class = 104
  120. update userdata set Class = 206 where struserid = @CharID and @Class = 201
  121. update userdata set Class = 208 where struserid = @CharID and @Class = 202
  122. update userdata set Class = 210 where struserid = @CharID and @Class = 203
  123. update userdata set Class = 212 where struserid = @CharID and @Class = 204
  124.  
  125. IF @@ERROR <> 0
  126. BEGIN
  127. ROLLBACK TRAN
  128. SET @nRet = 4
  129. RETURN
  130. END
  131.  
  132. COMMIT TRAN
  133. SET @nRet = 0
Add Comment
Please, Sign In to add comment