|
- ALTER PROCEDURE [dbo].[RMS_ADDSPECIALITEM]
- @ItemKind int,
- @ItemIndex int,
- @ItemDurability int,
- @Position int,
- @Map int,
- @X int,
- @Y int,
- @TileKind int,
- @bNeedCheckLimit int
- AS
- set nocount on
- declare @ItemCountLimit int, @CurrentItemCount int
- select @ItemCountLimit = 0
- begin transaction
- if @bNeedCheckLimit=1 --是否检查特装数量上限
- begin --获取物品的当前上限值
- select @ItemCountLimit = ItemCountLimit from tblSpecialItemLimit1 where ItemKind = @ItemKind and ItemIndex = @ItemIndex
- select @CurrentItemCount = @ItemCountLimit
- if @ItemIndex>=100 and @ItemIndex<=114 -- Total count of growth special item includes rating, generaion, speciality, perfect item.
- begin --生化统计各种变形值的总数
- select @CurrentItemCount =count(*) from tblSpecialItem1 where ItemKind = @ItemKind and (ItemIndex = @ItemIndex or ItemIndex = @ItemIndex+20 or ItemIndex = @ItemIndex+40 or ItemIndex = @ItemIndex+60 or ItemIndex = @ItemIndex+80)
- end
- else
- begin --获取物品的当前存在数量
- select @CurrentItemCount = count(*) from tblSpecialItem1 where ItemKind = @ItemKind and ItemIndex = @ItemIndex
- end
- end
- else --不需要检查上限,强制赋值,不达上限
- begin
- set @ItemCountLimit =1
- set @CurrentItemCount = 0
- end
- --未达到上限的
- if @ItemCountLimit > @CurrentItemCount
- begin
- --增加特装物品
- insert tblSpecialItem1 (ItemKind, ItemIndex, ItemDurability, Position, Map, X, Y, TileKind) values (@ItemKind, @ItemIndex, @ItemDurability,@Position, @Map, @X, @Y, @TileKind)
- end
- commit transaction
复制代码
|
|