Rayman 发表于 2009-6-21 01:30:37

无聊中,发个多功能的存储(爆点、负钱、负经验、卡团)~

本帖最后由 Rayman 于 2009-6-20 17:32 编辑


/****** 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=goldFROM 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 = 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, , , Loyalty, Face, City, Knights, Fame,
       Hp, Mp, Sp, Strong, Sta, Dex, Intel, Cha, Authority, Points, Gold, , Bind, PX, PZ, PY, dwTime, strSkill, strItem,strSerial, sQuestCount, strQuest, MannerPoint, LoyaltyMonthly
        FROM        USERDATA WHERE strUserId = @id

SET @nRet = @@RowCount

RETURN
GO
其实原理很简单,也是小儿科,但是解决了现存1299很多库的问题:负钱,负经验,卡团,爆点(涉及到另一个存储)等。此存储适用于1299,13xx,我觉得2.0也稍加修改可以用,虽然2.0的我没见过,但存储都大同小异。

arbies 发表于 2009-6-24 17:32:17

客观地讲,这种修正金钱的方法对于玩家是不公平的,由于服务器的限制而白白没了21E!

改进一下,在修正为绝对值的同时,能不能在其他地方返还这21E呢,例如仓库,例如往身上加金条

xz7323746 发表于 2009-6-25 06:23:59

好东西。

ykp! 发表于 2009-6-28 18:46:32

Ty For Share !

ctgwglzc 发表于 2009-6-28 20:22:39

客观地讲,这种修正金钱的方法对于玩家是不公平的,由于服务器的限制而白白没了21E!

改进一下,在修正为绝对值的同时,能不能在其他地方返还这21E呢,例如仓库,例如往身上加金条
arbies 发表于 2009-6-24 17:32 http://www.kofans.cn/bbs/static/image/common/back.gif
感觉钱多变付的人不值得同情

无敌小生 发表于 2009-8-9 14:44:39

{:1_204:}CT说的是实话哈哈

kfyyq 发表于 2009-8-10 15:58:49

你少发个存储过程,有毛用啊?哗众取宠!

Rayman 发表于 2009-8-12 03:03:45

楼上所说的少个存储,因为已经不重要了,你指的是:

--如果不是GM号,则强制检查能力点是否异常

IF @isGM<>0

BEGIN

      exec S_CheckPoint @id

END


在1299中,我是利用S_CheckPoint来检测人物点是否异常,但1310以后的版本,这几行删除好了,用不上了。

yl79401 发表于 2009-9-25 17:11:52

这么好的东西,不顶,还顶什么呢。
我顶
狂顶
再顶
继续顶
我再顶
加油顶
我一直顶
顶完了吧
大家来一起顶,哇哈哈,喝爽歪歪,精神好呀!

luluji 发表于 2009-9-27 10:45:58

说真的,1310我还没有真的用过?
页: [1] 2
查看完整版本: 无聊中,发个多功能的存储(爆点、负钱、负经验、卡团)~