CREATE PROCEDURE [dbo].[ACCOUNT_NATION_CHANGE]
@strAccountID as varchar(40),
@Nation as tinyint
AS
/*
Author : Ceribrio
*/
DECLARE @strNation tinyint,@Class int,@Race int,@strCharID1 char(21), @strCharID2 char(21), @strCharID3 char(21)
SELECT @strNation = bNation,@strCharID1 = strCharID1,@strCharID2 = strCharID2,@strCharID3 = strCharID3 FROM ACCOUNT_CHAR WHERE strAccountID = @strAccountID
SET @Class = null
SET @Race = null
IF @Nation = 1 and @strNation = 2
BEGIN
SELECT @Class = Class,@Race = Race FROM USERDATA WHERE strUserID = @strCharID1
IF @Class = 201 OR @Class = 205 OR @Class = 206
BEGIN
SET @Race = 1
END
IF @Class = 202 OR @Class = 207 OR @Class = 208
BEGIN
SET @Race = 2
END
IF @Class = 203 OR @Class = 209 OR @Class = 210
BEGIN
SET @Race = 3
END
IF @Class = 204 OR @Class = 211 OR @Class = 212
BEGIN
IF @Race = 12
BEGIN
SET @Race = 4
END
ELSE
BEGIN
SET @Race = 2
END
END
UPDATE USERDATA SET Nation = @Nation,Race = @Race,Class = @Class - 100 WHERE strUserID = @strCharID1
DELETE FROM KNIGHTS_USER WHERE strUserID = @strCharID1
SELECT @Class = Class,@Race = Race FROM USERDATA WHERE strUserID = @strCharID2
IF @Class = 201 OR @Class = 205 OR @Class = 206
BEGIN
SET @Race = 1
END
IF @Class = 202 OR @Class = 207 OR @Class = 208
BEGIN
SET @Race = 2
END
IF @Class = 203 OR @Class = 209 OR @Class = 210
BEGIN
SET @Race = 3
END
IF @Class = 204 OR @Class = 211 OR @Class = 212
BEGIN
IF @Race = 12
BEGIN
SET @Race = 4
END
ELSE
BEGIN
SET @Race = 2
END
END
UPDATE USERDATA SET Nation = @Nation,Race = @Race,Class = @Class - 100 WHERE strUserID = @strCharID2
DELETE FROM KNIGHTS_USER WHERE strUserID = @strCharID2
SELECT @Class = Class,@Race = Race FROM USERDATA WHERE strUserID = @strCharID3
IF @Class = 201 OR @Class = 205 OR @Class = 206
BEGIN
SET @Race = 1
END
IF @Class = 202 OR @Class = 207 OR @Class = 208
BEGIN
SET @Race = 2
END
IF @Class = 203 OR @Class = 209 OR @Class = 210
BEGIN
SET @Race = 3
END
IF @Class = 204 OR @Class = 211 OR @Class = 212
BEGIN
IF @Race = 12
BEGIN
SET @Race = 4
END
ELSE
BEGIN
SET @Race = 2
END
END
UPDATE USERDATA SET Nation = @Nation,Race = @Race,Class = @Class - 100 WHERE strUserID = @strCharID3
DELETE FROM KNIGHTS_USER WHERE strUserID = @strCharID3
UPDATE ACCOUNT_CHAR SET bNation = @Nation WHERE strAccountID = @strAccountID
END
IF @Nation = 2 and @strNation = 1
BEGIN
SELECT @Class = Class,@Race = Race FROM USERDATA WHERE strUserID = @strCharID1
IF @Class = 101 OR @Class = 105 OR @Class = 106
BEGIN
SET @Race = 12
END
IF @Class = 102 OR @Class = 107 OR @Class = 108
BEGIN
SET @Race = 12
END
IF @Class = 103 OR @Class = 109 OR @Class = 110
BEGIN
SET @Race = 12
END
IF @Class = 104 OR @Class = 111 OR @Class = 112
BEGIN
IF @Race = 4
BEGIN
SET @Race = 12
END
ELSE
BEGIN
SET @Race = 13
END
END
UPDATE USERDATA SET Nation = @Nation,Race = @Race,Class = @Class + 100 WHERE strUserID = @strCharID1
DELETE FROM KNIGHTS_USER WHERE strUserID = @strCharID1
SELECT @Class = Class,@Race = Race FROM USERDATA WHERE strUserID = @strCharID2
IF @Class = 101 OR @Class = 105 OR @Class = 106
BEGIN
SET @Race = 12
END
IF @Class = 102 OR @Class = 107 OR @Class = 108
BEGIN
SET @Race = 12
END
IF @Class = 103 OR @Class = 109 OR @Class = 110
BEGIN
SET @Race = 12
END
IF @Class = 104 OR @Class = 111 OR @Class = 112
BEGIN
IF @Race = 4
BEGIN
SET @Race = 12
END
ELSE
BEGIN
SET @Race = 13
END
END
UPDATE USERDATA SET Nation = @Nation,Race = @Race,Class = @Class + 100 WHERE strUserID = @strCharID2
DELETE FROM KNIGHTS_USER WHERE strUserID = @strCharID2
SELECT @Class = Class,@Race = Race FROM USERDATA WHERE strUserID = @strCharID3
IF @Class = 101 OR @Class = 105 OR @Class = 106
BEGIN
SET @Race = 12
END
IF @Class = 102 OR @Class = 107 OR @Class = 108
BEGIN
SET @Race = 12
END
IF @Class = 103 OR @Class = 109 OR @Class = 110
BEGIN
SET @Race = 12
END
IF @Class = 104 OR @Class = 111 OR @Class = 112
BEGIN
IF @Race = 4
BEGIN
SET @Race = 12
END
ELSE
BEGIN
SET @Race = 13
END
END
UPDATE USERDATA SET Nation = @Nation,Race = @Race,Class = @Class + 100 WHERE strUserID = @strCharID3
DELETE FROM KNIGHTS_USER WHERE strUserID = @strCharID3
UPDATE ACCOUNT_CHAR SET bNation = @Nation WHERE strAccountID = @strAccountID
ENDKullanımı :
Kod: