<p>CREATE PROCEDURE RMS_DECREASESPECIALITEMDURABILITY
@ItemKind int,
@ItemIndex int,
@ItemDurability int,
@ItemAttackGrade int,
@ItemStrengthGrade int,
@ItemSpiritGrade int,
@ItemDexterityGrade int,
@ItemPowerGrade int,
@Position int,
@GameID varchar(14),
@WindowKind int,
@WindowIndex int
AS
set nocount on
declare @DecreaseDurability int
declare @iMapID int
select @iMapID=Map From tblGameID1 Where GameID=@GameID
if (@iMapID=35 OR @iMapID=69 OR @iMapID=70 OR @iMapID=43) return
set @DecreaseDurability = 0
begin transaction
if @ItemDurability >= 4
begin
if (datepart(ms, getdate()) / 10) < 50
begin
set @DecreaseDurability = 1
end
end
else
begin
if @ItemDurability = 3
begin
if (datepart(ms, getdate()) / 10) < 40
begin
set @DecreaseDurability = 1
end
end
else
begin
if @ItemDurability = 2
begin
if (datepart(ms, getdate()) / 10) < 30
begin
set @DecreaseDurability = 1
end
end
else
begin
if @ItemDurability = 1
begin
if (datepart(ms, getdate()) / 10) < 20
begin
set @DecreaseDurability = 1
end
end
else
begin
if @ItemDurability = 0
begin
if (datepart(ms, getdate()) / 10) < 10
begin
set @DecreaseDurability = 1
end
end
else
begin
if (datepart(ms, getdate()) / 10) < 50
begin
delete tblSpecialItem1 where ID in (select top 1 ID from tblSpecialItem1 where ItemKind = @ItemKind and ItemIndex = @ItemIndex and ItemDurability = @ItemDurability and AttackGrade = @ItemAttackGrade and StrengthGrade = @ItemStrengthGrade and SpiritGrade = @ItemSpiritGrade and DexterityGrade = @ItemDexterityGrade and PowerGrade = @ItemPowerGrade and Position = @Position and GameID = @GameID and WindowKind = @WindowKind and WindowIndex = @WindowIndex)
-- if @@ROWCOUNT > 0
-- begin
insert tblSpecialItemLog1 (LogKind, ItemKind, ItemIndex, ItemDurability, Position, GameID, WindowKind, WindowIndex, LogItemCount,AttackGrade,StrengthGrade,SpiritGrade,DexterityGrade,PowerGrade) values (103, @ItemKind, @ItemIndex, @ItemDurability, @Position, @GameID, @WindowKind, @WindowIndex, @@ROWCOUNT,@ItemAttackGrade,@ItemStrengthGrade,@ItemSpiritGrade,@ItemDexterityGrade,@ItemPowerGrade)
-- end
end
end
end
end
end
end
if @DecreaseDurability = 1
begin
update tblSpecialItem1 set ItemDurability = ItemDurability - 1 where ID in (select top 1 ID from tblSpecialItem1 where ItemKind = @ItemKind and ItemIndex = @ItemIndex and ItemDurability = @ItemDurability and AttackGrade = @ItemAttackGrade and StrengthGrade = @ItemStrengthGrade and SpiritGrade = @ItemSpiritGrade and DexterityGrade = @ItemDexterityGrade and PowerGrade = @ItemPowerGrade and Position = @Position and GameID = @GameID and WindowKind = @WindowKind and WindowIndex = @WindowIndex)
end
commit transaction
GO </p>
控制语句为:
if (@iMapID=35 OR @iMapID=69 OR @iMapID=70 OR @iMapID=43) return
修改@iMapID后边等于的数字为地图号即可,多地图请用 OR 相隔,表示并列关系。