/****** Object: Stored Procedure dbo.RMS_USEHYCP Script Date: 2006-08-24 21:59:09 ******/
CCREATE PROCEDURE RMS_ITEMLOTTERY_USEITEM
@GameID varchar(14),
@WindowKind int,
@WindowIndex int,
@Time datetime,
@Itemnumber int,
@I int
AS
set nocount on
declare @RemoveHYCPError int
set @RemoveHYCPError = 1
begin transaction
delete tblSpecialItem1 where ID in (select top 1 ID from tblSpecialItem1 where ItemKind = 6 AND ItemIndex = 197 AND Position = 1 AND GameID = @GameID AND WindowKind = @WindowKind AND WindowIndex = @WindowIndex)
if @@ROWCOUNT > 0 and @@ERROR = 0
begin set @RemoveHYCPError = 0
select @I = I from tblysjs where ID = @RemoveHYCPError+1
if @I > 95
set @I = @I-94
end
select @itemnumber = itemnumber from tblysjs where ID = @I
insert into tblSpecialItem1 (ItemKind, ItemIndex, ItemDurability, Position, Map, X, Y, TileKind, GameID, WindowKind, WindowIndex, MiscTime, AttackGrade , StrengthGrade , SpiritGrade , DexterityGrade , PowerGrade ) values (6,@Itemnumber, 1, 1, 1, 1, 1, 1, @GameID, 1, 5, getdate(),0,0,0,0,0)
insert into tblMail1 (Time, Recipient, Sender, ReadOrNot, Title, Line, Content, Item) values (@Time, @GameID, '永胜架设', 0, '彩票中奖通知',9, '
感谢您使用永胜架设彩票系统,!!
永胜架设
QQ:620005069
', '0:6-@Itemnumber/1.')
insert into tblysjs (I ) values (@I+1)
if @RemoveHYCPError = 0
begin
commit transaction
end
else if @RemoveHYCPError != 0
begin
rollback transaction
end
GO