您当前的位置:首页 > 其他技术 > 其他技术

新破天一剑新手上线送物品触发

本文出处:网游动力作者:本站发布时间:2008-12-19阅读次数:
****** Object:  Trigger dbo.NewUserCard    Script Date: 2008-10-1 17:49:37 ******/
----------------------------为新手卡创建的角色发虚拟物品信息----------------------------
CREATE TRIGGER [NewUserCard] ON [dbo].[user]
FOR INSERT
AS
DECLARE @strUserID AS varchar(16)
SELECT @strUserID = account FROM [INSERTED]
IF EXISTS( SELECT USERID FROM [zone_items] WHERE USERID = @strUserID )
BEGIN
 UPDATE [zone_items] SET [CREATE_TIME] = GETDATE() WHERE USERID = @strUserID
 DECLARE @strLeft AS varchar(5), @strRight AS varchar(8)
 DECLARE @nNumber AS INT
 SET @strLeft = LEFT( @strUserID, 2 )
 SET @strRight = RIGHT( @strUserID, 6 )
 SET @nNumber = CAST( @strRight AS INT )
 IF ( @strLeft = 'X_' AND @nNumber >= 246501 AND @nNumber <= 246550 )
 BEGIN
  INSERT INTO [give_itemlist]( account, item_id, cnt ) values( @strUserID, 73, 1 )
  INSERT INTO [give_itemlist]( account, item_id, cnt ) values( @strUserID, 79, 1 )
  INSERT INTO [give_itemlist]( account, item_id, cnt ) values( @strUserID, 85, 1 )
  INSERT INTO [give_itemlist]( account, item_id, cnt ) values( @strUserID, 91, 1 )
  INSERT INTO [give_itemlist]( account, item_id, cnt ) values( @strUserID, 103, 1 )
  INSERT INTO [give_itemlist]( account, item_id, cnt ) values( @strUserID, 109, 1 )
  INSERT INTO [give_itemlist]( account, item_id, cnt ) values( @strUserID, 115, 1 )
  INSERT INTO [give_itemlist]( account, item_id, cnt ) values( @strUserID, 121, 1 )
  INSERT INTO [give_itemlist]( account, item_id, cnt ) values( @strUserID, 366, 1 )
 END
 ELSE
 BEGIN
  INSERT INTO [give_itemlist]( account, item_id, cnt ) values( @strUserID, 170, 100 )
  INSERT INTO [give_itemlist]( account, item_id, cnt ) values( @strUserID, 186, 1 )
  INSERT INTO [give_itemlist]( account, item_id, cnt ) values( @strUserID, 195, 1 )
  INSERT INTO [give_itemlist]( account, item_id, cnt ) values( @strUserID, 240, 1 )
  INSERT INTO [give_itemlist]( account, item_id, cnt ) values( @strUserID, 368, 1 )
  INSERT INTO [give_itemlist]( account, item_id, cnt ) values( @strUserID, 2857, 1 )
  INSERT INTO [give_itemlist]( account, item_id, cnt ) values( @strUserID, 2873, 1 )
  INSERT INTO [give_itemlist]( account, item_id, cnt ) values( @strUserID, 2879, 1 )
  INSERT INTO [give_itemlist]( account, item_id, cnt ) values( @strUserID, 2805, 1 )
  INSERT INTO [give_itemlist]( account, item_id, cnt ) values( @strUserID, 2807, 1 )
  INSERT INTO [give_itemlist]( account, item_id, cnt ) values( @strUserID, 2806, 1 )
  INSERT INTO [give_itemlist]( account, item_id, cnt ) values( @strUserID, 2808, 1 )
 END
END