 - REATE PROCEDURE CHANGE_NEW_ID
- @ServerNo tinyint,
- @AccountID char(21),
- @BeforeID char(21),
- @ChangeID char(21),
- @nRet smallint OUTPUT
- AS
- declare @Nation tinyint, @Race tinyint, @Class smallint, @HairColor tinyint, @Rank tinyint, @Title tinyint, @Level tinyint, @Exp int, @Loyalty int, @Face tinyint, @City tinyint, @Knights smallint
- declare @Fame tinyint, @Hp smallint, @Mp smallint, @Sp smallint, @Str tinyint, @Sta tinyint, @Dex tinyint, @Intel tinyint, @Cha tinyint, @Authority smallint, @Points tinyint, @Gold int, @Zone tinyint
- declare @Bind smallint, @PX int, @PZ int, @PY int, @dwTime int, @QuestTotal smallint, @strSkill varchar(20), @strItem varchar(400), @strSerial varchar(400), @sQuest smallint, @strQuest varchar(400)
- declare @CharID1 char(21), @CharID2 char(21), @CharID3 char(21)
-
- BEGIN TRAN
- SELECT @CharID1 = strCharID1, @CharID2 = strCharID2, @CharID3 = strCharID3 FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID
- IF @CharID1 = @BeforeID
- BEGIN
- UPDATE ACCOUNT_CHAR SET strCharID1 = @ChangeID WHERE strAccountID = @AccountID
- END
- ELSE IF @CharID2 = @BeforeID
- BEGIN
- UPDATE ACCOUNT_CHAR SET strCharID2 = @ChangeID WHERE strAccountID = @AccountID
- END
- ELSE IF @CharID3 = @BeforeID
- BEGIN
- UPDATE ACCOUNT_CHAR SET strCharID3 = @ChangeID WHERE strAccountID = @AccountID
- END
- IF @@ERROR <> 0
- BEGIN
- ROLLBACK TRAN
- SET @nRet = 1
- RETURN
- END
- 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, @Hp = Hp, @Mp = Mp, @Sp = Sp, @Str = 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, @dwTime = dwTime, @strSkill = strSkill, @strItem = strItem, @strSerial = strSerial, @sQuest = sQuestCount, @strQuest = strQuest
- FROM USERDATA WHERE strUserId = @BeforeID
- INSERT INTO USERDATA (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, dwTime, strSkill, strItem,strSerial, sQuestCount, strQuest )
- VALUES (@ChangeID, @Nation, @Race, @Class, @HairColor, @Rank, @Title, @Level, @Exp, @Loyalty, @Face, @City, @Knights,
- @Fame, @Hp, @Mp, @Sp, @Str, @Sta, @Dex, @Intel, @Cha, @Authority, @Points, @Gold, @Zone, @Bind, @PX, @PZ, @PY, @dwTime, @strSkill, @strItem, @strSerial, @sQuest, @strQuest )
- IF @@ERROR <> 0
- BEGIN
- ROLLBACK TRAN
- SET @nRet = 2
- RETURN
- END
- UPDATE USERDATA SET City = 255 WHERE strUserID = @BeforeID -- ?? ???? ?? ??? ???.
- SET XACT_ABORT ON
- INSERT INTO [Account_Log].[dbo].[CHANGE_ID_LOG] (nServerNo, strAccountID, strBeforeID, strChangedID) VALUES (@ServerNo, @AccountID, @BeforeID, @ChangeID)
- IF @@ERROR <> 0
- BEGIN
- ROLLBACK TRAN
- SET @nRet = 3
- RETURN
- END
- COMMIT TRAN
- SET @nRet = 0
- GO
复制代码 |