红月私服生化15改,K生化精准控制触发
USE [redmoon]
GO IF EXISTS (SELECT 1 FROM SYSOBJECTS WHERE ID = OBJECT_ID('RMS_DOITEMGROWTH') AND TYPE = 'P') DROP PROC RMS_DOITEMGROWTH GO /****** 对象: StoredProcedure [dbo].[RMS_DOITEMGROWTH] 脚本日期: 12/31/2011 14:28:06 ******/ SET ANSI_NULLS OFF GO SET QUOTED_IDENTIFIER OFF GO -- ============================================= -- Author: redzl (请保留版权,转载请注明出处) -- Create date: 2011年12月31日 14:33:59 -- Description: 修改后可以升级生化最高到15改,并增加新生化一套,为防止与某些服务器信仰(115,135,155,175)无畏(116,136,156,176)冲突,添加的新生化位置代码分别为: -- 生化头盔k ItemIndex = 117 由180变形 -- 生化甲K ItemIndex = 118 由181变形 -- 生化裤K ItemIndex = 119 由182变形 -- 生化靴K ItemIndex = 137 由183变形 -- 生化盾牌K ItemIndex = 138 由184变形 -- 生化手套K ItemIndex = 139 由185变形 -- 生化腰带K ItemIndex = 157 由186变形 -- ============================================= CREATE PROCEDURE [dbo].[RMS_DOITEMGROWTH] @GameID varchar(14), @WindowKind int, @WindowIndex int, @ItemKind int, @ItemIndex int, @AttackGrade int, @StrengthGrade int, @SpiritGrade int, @DexterityGrade int, @PowerGrade int, @NextItemKind int, @NextItemIndex int, @NextAttackGrade int, @NextStrengthGrade int, @NextSpiritGrade int, @NextDexterityGrade int, @NextPowerGrade int AS set nocount on; DECLARE @ItemID int, @RandNum int, @UpdateSuccess int, @MaxAttackGrade int, @DebugNewItem int, @DebugUpgrade int SELECT @ItemID= 0, @UpdateSuccess = 0, @MaxAttackGrade = 15, --设置生化最高等级限制,注意:[小于等于4则不做修改,保持官方升级几率] @DebugNewItem = 0, --是否开启新生化调试模式,开启后符合条件的生化100%升级为新生化 (0:关闭 1:开启) @DebugUpgrade = 0 --是否开启升级调试模式,开启后符合条件的生化升级到最高等级限制之前,等级提升100%成功[只升等级,不升四围] (0:关闭 1:开启) Declare @S1 int,@S2 int,@S3 int,@S5 int,@S8 int,@S10 int,@S12 int,@S14 int SELECT @S1 = 15, --全新,R生化的变形几率 @S2 = 10, --二改生化的变形几率(G升级到S) @S3 = 8, --三改生化的变形几率(S升级到P) @S5 = 7, --4 ~ 5级的生化升级几率 @S8 = 6, --6 ~ 8级的生化升级几率 @S10= 5, --9~~10级的生化升级几率 @S12= 4, --11~12级的生化升级几率 @S14= 3 --13~14级的生化升级几率 SELECT TOP 1 @ItemID=ID FROM tblSpecialItem1 WHERE GameID = @GameID AND WindowKind = @WindowKind AND WindowIndex = @WindowIndex AND ItemKind = @ItemKind AND ItemIndex= @ItemIndex AND AttackGrade = @AttackGrade AND StrengthGrade = @StrengthGrade AND SpiritGrade = @SpiritGrade AND DexterityGrade = @DexterityGrade AND PowerGrade = @PowerGrade AND Position=1 IF @ItemID > 0 BEGIN TRANSACTION REDZL BEGIN IF @DebugNewItem = 1 SET @RandNum = -1 ELSE SET @RandNum = CAST(RAND() * 100000 AS INT) % 100 --4改以上的P生化装备每次升级有3%的几率变成K生化,如要修改几率请修改"@RandNum <"后面的数字,数字越小几率越小,不启用新生化请将该数字设为0(若已开启调试模式,则此处设置无效) if (@ItemIndex between 180 and 186) and @AttackGrade >= 4 and @RandNum < 3 Begin SELECT @NextItemIndex = Case @ItemIndex When 180 Then 117 When 181 Then 118 When 182 Then 119 When 183 Then 137 When 184 Then 138 When 185 Then 139 When 186 Then 157 End, @NextAttackGrade = @AttackGrade, @NextStrengthGrade = @StrengthGrade, @NextSpiritGrade = @SpiritGrade, @NextDexterityGrade = @DexterityGrade, @NextPowerGrade = @PowerGrade End Else If @MaxAttackGrade > 4 --不变新生化则进入正常升级流程 Begin if @AttackGrade < @MaxAttackGrade BEGIN IF @DebugUpgrade = 1 SET @RandNum = -1 ELSE SET @RandNum = CAST(RAND() * 100000 AS INT) % 100 if (@AttackGrade between 0 and 1) and @RandNum <= @S1 Set @UpdateSuccess = 1 Else if @AttackGrade = 2 and @RandNum <= @S2 Set @UpdateSuccess = 1 Else if @AttackGrade = 3 and @RandNum <= @S3 Set @UpdateSuccess = 1 Else if (@AttackGrade between 4 and 5) and @RandNum <= @S5 Set @UpdateSuccess = 1 Else if (@AttackGrade between 6 and 8) and @RandNum <= @S8 Set @UpdateSuccess = 1 Else if (@AttackGrade between 9 and 10) and @RandNum <= @S10 Set @UpdateSuccess = 1 Else if (@AttackGrade between 11 and 12) and @RandNum <= @S12 Set @UpdateSuccess = 1 Else if (@AttackGrade between 13 and 14) and @RandNum <= @S14 Set @UpdateSuccess = 1 End Select @NextItemIndex = Case When (@AttackGrade < 4 and @UpdateSuccess = 1) Then @ItemIndex + 20 else @ItemIndex End, @NextAttackGrade = Case @UpdateSuccess When 1 Then @AttackGrade + 1 Else @AttackGrade End, @NextStrengthGrade = Case @UpdateSuccess When 1 Then @StrengthGrade else @NextStrengthGrade End, @NextSpiritGrade = Case @UpdateSuccess When 1 Then @SpiritGrade else @NextSpiritGrade End, @NextDexterityGrade = Case @UpdateSuccess When 1 Then @DexterityGrade else @NextDexterityGrade End, @NextPowerGrade = Case @UpdateSuccess When 1 Then @PowerGrade else @NextPowerGrade End END UPDATE tblSpecialItem1 SET ItemKind = @NextItemKind, ItemIndex = @NextItemIndex, AttackGrade = @NextAttackGrade ,StrengthGrade = @NextStrengthGrade, SpiritGrade = @NextSpiritGrade, DexterityGrade = @NextDexterityGrade, PowerGrade = @NextPowerGrade WHERE ID = @ItemID END if @@Error = 0 BEGIN COMMIT TRANSACTION REDZL END ELSE BEGIN ROLLBACK TRANSACTION REDZL END |