本帖最后由 Rayman 于 2012-8-4 15:16 编辑
看过此贴,有感,是而发一段好多人都想要的存储。
- CREATE PROCEDURE CREATE_NEW_CHAR
- @nRet smallint OUTPUT,
- @AccountID char(21),
- @index tinyint,
- @CharID char(21),
- @Race tinyint,
- @Class smallint,
- @Hair tinyint,
- @Face tinyint,
- @Str tinyint,
- @Sta tinyint,
- @Dex tinyint,
- @Intel tinyint,
- @Cha tinyint
- AS
- DECLARE @Row tinyint, @Nation tinyint, @Zone tinyint, @PosX int, @PosZ int
- SET @Row = 0 SET @Nation = 0 SET @Zone = 0 SET @PosX = 0 SET @PosZ = 0
- SELECT @Nation = bNation, @Row = bCharNum FROM ACCOUNT_CHAR WHERE strAccountID = @AccountID
-
- --只准建三个人
- IF @Row >=3 SET @nRet = 1
-
- IF @Nation = 1 AND @Race > 10 SET @nRet = 2
- ELSE IF @Nation = 2 AND @Race < 10 SET @nRet = 2
- ELSE IF @Nation <>1 AND @Nation <> 2 SET @nRet = 2
- IF @nRet > 0
- RETURN
-
- SELECT @Row = COUNT(*) FROM USERDATA WHERE strUserId = @CharID
- IF @Row > 0
- BEGIN
- SET @nRet = 3
- RETURN
- END
- --SET @Zone = @Nation
- SET @Zone=21
- SELECT @PosX = InitX, @PosZ = InitZ FROM ZONE_INFO WHERE ZoneNo = @Zone
-
- BEGIN TRAN
- IF @index = 0--中间的
- UPDATE ACCOUNT_CHAR SET strCharID1 = @CharID, bCharNum = bCharNum + 1 WHERE strAccountID = @AccountID
- ELSE IF @index = 1--左边的
- UPDATE ACCOUNT_CHAR SET strCharID2 = @CharID, bCharNum = bCharNum + 1 WHERE strAccountID = @AccountID
- ELSE IF @index = 2 --右边的
- UPDATE ACCOUNT_CHAR SET strCharID3 = @CharID, bCharNum = bCharNum + 1 WHERE strAccountID = @AccountID
- --ELSE IF @index = 3 --sohu未开放的
- -- UPDATE ACCOUNT_CHAR SET strCharID4 = @CharID, bCharNum = bCharNum + 1 WHERE strAccountID = @AccountID
- --ELSE IF @index = 4 --sohu未开放的
- --UPDATE ACCOUNT_CHAR SET strCharID5 = @CharID, bCharNum = bCharNum + 1 WHERE strAccountID = @AccountID
-
- --如果是中间的,则给80级,否则给1级
- IF @index=0
- INSERT INTO USERDATA (strUserId,strAccountID, Nation, Race, Class, HairColor, Face, Strong, Sta, Dex, Intel, Cha, Zone, PX, PZ ,loyalty,exp,level,gold,points,strsKill) VALUES (@CharID,@AccountID, @Nation, @Race, @Class, @Hair, @Face, @Str, @Sta, @Dex, @Intel, @Cha, @Zone, @PosX, @PosZ,100,1000000000,80,500000,277,0x8E000000000000000000)
- ELSE
- INSERT INTO USERDATA (strUserId,strAccountID, Nation, Race, Class, HairColor, Face, Strong, Sta, Dex, Intel, Cha, Zone, PX, PZ ,loyalty,exp,gold) VALUES (@CharID,@AccountID, @Nation, @Race, @Class, @Hair, @Face, @Str, @Sta, @Dex, @Intel, @Cha, @Zone, @PosX, @PosZ,100,1000000000,500000)
- ------------------------------------------------------------------------------------------------------------------------------------------
- --开始发放新手装备
- IF @index=0 --如果是80级的号,给80的装备,否则让其自己打
- BEGIN
- DECLARE @strItem char(400)
- IF @Class=101 or @Class=201 or @Class=106 or @Class=206
- BEGIN
- select @strItem=strItem from userdata where struserid='warrior'
- update userdata set strItem=@strItem where struserid=@CharID
- END
- IF @Class=102 or @Class=202 or @Class=108 or @Class=208
- BEGIN
- select @strItem=strItem from userdata where struserid='roger'
- update userdata set strItem=@strItem where struserid=@CharID
- END
- IF @Class=103 or @Class=203 or @Class=110 or @Class=210
- BEGIN
- select @strItem=strItem from userdata where struserid='mace'
- update userdata set strItem=@strItem where struserid=@CharID
- END
- IF @Class=104 or @Class=204 or @Class=112 or @Class=212
- BEGIN
- select @strItem=strItem from userdata where struserid='premist'
- update userdata set strItem=@strItem where struserid=@CharID
- END
- END
- ------------------------------------------------------------------------------------------------------------------------------------------
-
- IF @@ERROR <> 0
- BEGIN
- ROLLBACK TRAN
- SET @nRet = 4
- RETURN
- END
-
- COMMIT TRAN
- SET @nRet = 0
- GO
复制代码 存储说明:
这个存储是允许建三个人物,中间的为80级(技能和能力点给到位了),两边的就默认1级,上线后复制初始人物装备。装备来源为四个初始号,分别是warriror,roger,mace,premist。
此存储比CT发的要精简,无需再新建一个存储为实现所需功能。操作也灵活,只需更改四个初始号上的装备即可。
后记:
其实懂存储的人一看就知道是小儿科了,只有想不到,没有做不到,深入技术才是根本,怎么抄都没用的。网上下的再好的端也是个废品,因为好的东西是高手不断完善来才得来的,真正好的东西,很难在网上下载的到。也由此B4一下那些成天害人的垃圾,比如以前的什么招牌、788等。我想说的是:有本事的人一般不会倒处招摇。 |