| 本帖最后由 Rayman 于 2009-6-20 17:32 编辑 
 其实原理很简单,也是小儿科,但是解决了现存1299很多库的问题:负钱,负经验,卡团,爆点(涉及到另一个存储)等。此存储适用于1299,13xx,我觉得2.0也稍加修改可以用,虽然2.0的我没见过,但存储都大同小异。复制代码
/****** Object:  Stored Procedure dbo.LOAD_USER_DATA    Script Date: 2009-04-10 11:09 am ******/
--最后修改:BY Slleo
CREATE PROCEDURE LOAD_USER_DATA
@AccountID        char(21),
@id                char(21),
@nRet                smallint OUTPUT
AS
--GM号的登陆
Declare @isGM int,@nzone int,@knights int,@exp int,@gold int
SELECT @isGM = Authority,@nzone=zone,@gold=gold  FROM USERDATA WHERE strUserID =@id
--如果不是GM号,则强制检查能力点是否异常
IF @isGM<>0
BEGIN
        exec S_CheckPoint @id
END
--把非GM号移到DLW
if @nzone=21 and @isGM<>0
begin
        update userdata set zone=30,PX=50000,PZ=25500,PY=8340 WHERE strUserId = @id
end
--修正卡团现象
IF @knights=0
BEGIN
        delete from knights_user WHERE strUserId = @id
END
--修正负经验
IF @exp<0
BEGIN
        UPDATE USERDATA SET exp=100,hp=100 WHERE strUserId = @id
END
--修正负金钱
if @gold < 0
begin
update userdata set gold = abs(@gold) where struserid = @id
end
--对登陆者的时间进行记录
BEGIN
        INSERT INTO S_UserLog (strAccountID,strUserID, LoginDate,strAction) VALUES (@AccountID,@id, getdate(),'Login')
END
--以下开始自动二转
DECLARE @class char(21),@levelim int
set @class = (select class from userdata where struserid = @id)
Select @levelim = [Level] FROM USERDATA WHERE strUserID = @id
if @class = 105 AND @levelim > 59 
begin
update userdata set class = 106 where struserid = @id
end
if @class = 107 AND @levelim > 59 
begin
update userdata set class = 108 where struserid = @id 
end
if @class = 109 AND @levelim > 59 
begin
update userdata set class = 110 where struserid = @id 
end
if @class = 111 AND @levelim > 59 
begin
update userdata set class = 112 where struserid = @id 
end
if @class = 205 AND @levelim > 59 
begin
update userdata set class = 206 where struserid = @id 
end
if @class = 207 AND @levelim > 59 
begin
update userdata set class = 208 where struserid = @id 
end
if @class = 209 AND @levelim > 59 
begin
update userdata set class = 210 where struserid = @id 
end
if @class = 211 AND @levelim > 59
begin
update userdata set class = 212 where struserid = @id 
end
--以下是此存储原来拥有的部分,不可删除
DECLARE @charid1 char(21), @charid2 char(21), @charid3 char(21)
DECLARE @True smallint
SET @charid1 = null
SET @charid2 = null
SET @charid3 = null
SET @True = 0
SET @nRet = 0
SELECT @charid1 = strCharID1, @charid2 = strCharID2, @charid3 = strCharID3 FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID
IF @id = @charid1 or @id = @charid2 or @id = @charid3 
        SET @True = 1
IF @True = 0
BEGIN
        SET @nRet = 0
        RETURN
END
SELECT 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, MannerPoint, LoyaltyMonthly
        FROM        USERDATA WHERE strUserId = @id
SET @nRet = @@RowCount
RETURN
GO
 |