红月论坛

 找回密码
 立即注册
查看: 8479|回复: 5

RMS_ADDSPECIALITEM

[复制链接]
发表于 2019-1-31 20:01:56 | 显示全部楼层 |阅读模式
  1. ALTER PROCEDURE [dbo].[RMS_ADDSPECIALITEM]
  2.         @ItemKind int,
  3.         @ItemIndex int,
  4.         @ItemDurability int,
  5.         @Position int,
  6.         @Map int,
  7.         @X int,
  8.         @Y int,
  9.         @TileKind int,
  10.         @bNeedCheckLimit int

  11. AS

  12. set nocount on

  13. declare @ItemCountLimit int, @CurrentItemCount int

  14. select @ItemCountLimit = 0

  15. begin transaction

  16. if @bNeedCheckLimit=1  --是否检查特装数量上限
  17. begin  --获取物品的当前上限值
  18.         select @ItemCountLimit = ItemCountLimit from tblSpecialItemLimit1 where ItemKind = @ItemKind and ItemIndex = @ItemIndex
  19.         select @CurrentItemCount = @ItemCountLimit
  20.         if @ItemIndex>=100 and @ItemIndex<=114                -- Total count of growth special item includes rating, generaion, speciality, perfect item.
  21.         begin  --生化统计各种变形值的总数
  22.                 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)
  23.         end
  24.         else
  25.         begin  --获取物品的当前存在数量
  26.                 select @CurrentItemCount = count(*) from tblSpecialItem1 where ItemKind = @ItemKind and ItemIndex = @ItemIndex
  27.         end
  28. end
  29. else  --不需要检查上限,强制赋值,不达上限
  30. begin
  31.         set @ItemCountLimit =1
  32.         set @CurrentItemCount = 0
  33. end

  34. --未达到上限的
  35. if @ItemCountLimit > @CurrentItemCount
  36. begin
  37. --增加特装物品
  38.         insert tblSpecialItem1 (ItemKind, ItemIndex, ItemDurability, Position, Map, X, Y, TileKind) values (@ItemKind, @ItemIndex, @ItemDurability,@Position, @Map, @X, @Y, @TileKind)

  39. end

  40. commit transaction
复制代码


学习红月技术,我只来红月论坛!
回复

使用道具 举报

 楼主| 发表于 2019-2-9 19:26:59 | 显示全部楼层

原版存储,记录一下。
学习红月技术,我只来红月论坛!
回复

使用道具 举报

 楼主| 发表于 2019-2-18 18:48:25 | 显示全部楼层

最近在整理存储过程,只是保存一下原版存储,做一些注释。
学习红月技术,我只来红月论坛!
回复

使用道具 举报

发表于 2021-4-20 12:03:04 | 显示全部楼层
好好学习,天天向上!
学习红月技术,我只来红月论坛!
回复

使用道具 举报

QQ|手机版|小黑屋|红月论坛

GMT+8, 2024-4-18 16:35

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表