求3.8掉红特触发器
红月技术吧
全部回复
仅看楼主
level 5
riky_lin 楼主
求3.8掉红特触发器
2014年07月27日 12点07分 1
level 7
CREATE TRIGGER diaohongte ON tblSpecialItem1
FOR INSERT
AS
set nocount on
DECLARE @id int ,@map int
SELECT @map= map,@id=id FROM INSERTED
--括号内是地图号,就比如说你设置住1可以掉特的话,就加上1,以*,*号分开
if @map in (1,2,3,4,5,6,7,8)
begin
UPDATE tblSpecialItem1 SET ItemDurability=-1 WHERE id=@id
end
上面的复制过去直接查询分析器
试试看,有问题跟我说
2014年07月27日 12点07分 2
加完这个储存直接不掉特了
2014年07月27日 13点07分
level 7
上面的错了,下面的正确,3.8可以用
但这个不是掉出红特,而是捡起来变成红特
CREATE TRIGGER hongte ON dbo.tblSpecialItem1
FOR UPDATE
AS
set nocount on
DECLARE @id int ,@map int
SELECT @id=id FROM INSERTED
if update(Position)
begin
UPDATE tblSpecialItem1 SET ItemDurability=-1 WHERE id=@id
end
2014年07月27日 15点07分 3
3Q,虽然有BUG,辛苦了,期待时间特的教程
2014年07月27日 15点07分
level 7

上面括号内的1,2,8设置你想要捡起来变红的特
2014年07月28日 06点07分 4
我希望全区都掉红特
2014年07月28日 09点07分
level 5
riky_lin 楼主
CREATE PROCEDURE dbo.RMS_PICKUPITEM
@ItemKind int,
@ItemIndex int,
@ItemDurability int,
@ItemAttackGrade int,
@ItemStrengthGrade int,
@ItemSpiritGrade int,
@ItemDexterityGrade int,
@ItemPowerGrade int,
@ItemCount int,
@FromPosition int,
@Map int,
@X int,
@Y int,
@TileKind int,
@ToPosition int,
@GameID varchar(14),
@WindowKind int,
@WindowIndex int
AS
set nocount on
declare @TempItemCount int,@ItemID int,@NewItemDurability int
select @TempItemCount = -1
begin transaction
select top 1 @ItemID = 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 = @FromPosition and Map = @Map and X = @X and Y = @Y and TileKind = @TileKind
if ((@ItemID between 50 and 100) and @ItemDurability = 4) set @NewItemDurability = -1
else set @NewItemDurability = @ItemDurability
if @FromPosition = 0 and @ToPosition = 1 and ((@WindowKind = 1 and @WindowIndex >= 0 and @WindowIndex < 100) or (@WindowKind = 3 and @WindowIndex >= 0 and @WindowIndex < 8))
begin
select @TempItemCount = count(*) from tblSpecialItem1 where Position = @ToPosition and GameID = @GameID and (ItemKind != @ItemKind or ItemIndex != @ItemIndex or ItemDurability != @ItemDurability or AttackGrade != @ItemAttackGrade or StrengthGrade != @ItemStrengthGrade or SpiritGrade != @ItemSpiritGrade or DexterityGrade != @ItemDexterityGrade or PowerGrade != @ItemPowerGrade) and WindowKind = @WindowKind and WindowIndex = @WindowIndex
if @TempItemCount = 0
begin
declare @SQLStatement varchar(1024)
set @SQLStatement = *update tblSpecialItem1 set Position = * + convert(varchar, @ToPosition) + *, GameID = *** + @GameID + ***, WindowKind = * + convert(varchar, @WindowKind) + *,ItemDurability = * + convert(varchar,@NewItemDurability) + *, WindowIndex = * + convert(varchar, @WindowIndex) + * where ID in (select top * + convert(varchar, @ItemCount) + * ID from tblSpecialItem1 where ItemKind = * + convert(varchar, @ItemKind) + * and ItemIndex = * + convert(varchar, @ItemIndex) + * and ItemDurability = * + convert(varchar, @ItemDurability) + * and AttackGrade = * + convert(varchar,@ItemAttackGrade ) + * and StrengthGrade = * + convert(varchar, @ItemStrengthGrade) + * and SpiritGrade = * + convert(varchar, @ItemSpiritGrade) + * and DexterityGrade = * + convert(varchar, @ItemDexterityGrade) + * and PowerGrade = * + convert(varchar, @ItemPowerGrade) + * and Position = * + convert(varchar, @FromPosition) + * and Map = * + convert(varchar, @Map) + * and X = * + convert(varchar, @X) + * and Y = * + convert(varchar, @Y) + * and TileKind = * + convert(varchar, @TileKind) + *)*
exec (@SQLStatement)
end
end
else if @FromPosition = 0 and @ToPosition = 1 and @WindowKind = 0 and @ItemKind=6 and (@ItemIndex=198 or @ItemIndex=199 or @ItemIndex=201 or @ItemIndex=202 or @ItemIndex=203)
begin
declare @Time datetime
insert tb
lsp
ecialitem1 (ItemKind, ItemIndex, ItemDurability, Position, Map, X, Y, TileKind, GameID, WindowKind, WindowIndex, MiscTime,AttackGrade,StrengthGrade,SpiritGrade,DexterityGrade,PowerGrade) values (6, @ItemIndex, 4, 2, 1, 100, 100, 1, @GameID, 3, 7, @Time, 0, 0, 0, 0, 0)
declare @SQLStatement2 varchar(1024)
set @SQLStatement2 = *update tblSpecialItem1 set Position = * + convert(varchar, @ToPosition) + *, GameID = *** + @GameID + ***, WindowKind = * + convert(varchar, @WindowKind) + *,ItemDurability = * + convert(varchar,@NewItemDurability) + *, WindowIndex = * + convert(varchar, @WindowIndex) + * where ID in (select top * + convert(varchar, @ItemCount) + * ID from tblSpecialItem1 where ItemKind = * + convert(varchar, @ItemKind) + * and ItemIndex = * + convert(varchar, @ItemIndex) + * and ItemDurability = * + convert(varchar, @ItemDurability) + * and AttackGrade = * + convert(varchar,@ItemAttackGrade ) + * and StrengthGrade = * + convert(varchar, @ItemStrengthGrade) + * and SpiritGrade = * + convert(varchar, @ItemSpiritGrade) + * and DexterityGrade = * + convert(varchar, @ItemDexterityGrade) + * and PowerGrade = * + convert(varchar, @ItemPowerGrade) + * and Position = * + convert(varchar, @FromPosition) + * and Map = * + convert(varchar, @Map) + * and X = * + convert(varchar, @X) + * and Y = * + convert(varchar, @Y) + * and TileKind = * + convert(varchar, @TileKind) + *)*
exec (@SQLStatement2)
end
commit transaction
GO
2014年07月28日 14点07分 5
1