友情提示:奇迹私服无保障,喜爱奇迹请支持官方奇迹MU!

游戏资料库

你当前的位置:奇迹私发网 > 技术资料 > 内容

技术资料

奇迹MU部分SQL触发器命令


减少数据库占用率:
backup log MuOnline with NO_LOG
backup log MuOnline with TRUNCATE_ONLY
DBCC SHRINKDATABASE(MuOnline)
backup log Ranking with NO_LOG
backup log Ranking with TRUNCATE_ONLY
DBCC SHRINKDATABASE(Ranking)


圣导送9999统率:

CREATE TRIGGER [Leadership] ON [dbo].[Character]
after Insert
as
Update [Character] set [Character].Leadership=9999
From Inserted
Where Inserted.Class=64 and [Character].accountid=inserted.accountid
and [Character].name=inserted.name

血色24次修改:
USE Ranking
go
UPDATE [Ranking].[dbo].[T_ENTER_CHECK_BC]
SET [ToDayEnterCount]= 1
USE MUONLINE
go
UPDATE [Ranking].[dbo].[T_ENTER_CHECK_BC]
SET [ToDayEnterCount]= 1

 


SET        @iMaxEnterCheck    =24        -- 老老 弥措 涝厘啊瓷 冉荐


SET ToDayEnterCount = ToDayEnterCount + 1, LastEnterDate = GetDate()

SET ToDayEnterCount = ToDayEnterCount + 0, LastEnterDate = GetDate()


修改所有追28变24:
begin
set nocount on


declare @usercount int
declare @erruser int
declare @itemcount int
declare @itemone int
set @usercount=0
set @erruser=0
set @itemcount=0

declare @extck int
declare @m_uid varchar(10)    --用户ID
declare @m_name varchar(10)    --角色名
declare @m_items varbinary(1200)    --收回前物品
declare @m_ritems varbinary(1200)    --收回后物品

declare @i int
declare @m_itm binary(10)

declare cur CURSOR for
    select c.accountid,c.name,c.Inventory as items
        from character c
        where c.Inventory is not null
open cur
fetch next from cur into @m_uid,@m_name,@m_items
while @@FETCH_STATUS=0    --提取成功
begin
    set @itemone=0
    set @i=0
    while @i<76
    begin
        set @m_itm=substring(@m_items,@i*10+1,10)
        --检查是否有查找的物品
        if substring(@m_itm,1,1)<>0xFF
            and (cast(substring(@m_itm,2,1) as tinyint) & 3)=3
            and (cast(substring(@m_itm,8,1) as tinyint) & 0x40)<>0
        begin
            set @m_itm=substring(@m_itm,1,1)+cast((cast(substring(@m_itm,2,1) as tinyint) & 0xFE) as binary(1))+substring(@m_itm,3,8)
            set @itemone=@itemone+1
        end
        --生成新的物品数据
        if @i<1
           set @m_ritems = @m_itm
        else
           set @m_ritems = @m_ritems+@m_itm
   
        set @i=@i+1
    end
    --写入
    begin tran   
        update character set Inventory=@m_ritems
             where accountid=@m_uid and [name]=@m_name
    if @@error<>0
    begin
        rollback tran
        set @erruser=@erruser+1
    end
    else
    begin
        commit tran
        set @usercount=@usercount+1
        set @itemcount=@itemcount+@itemone
    end

    fetch next from cur into @m_uid,@m_name,@m_items
end
DEALLOCATE cur

--修改仓库物品
declare cur CURSOR for
    select w.accountid,w.items
        from warehouse w
        where w.items is not null
open cur
fetch next from cur into @m_uid,@m_items
while @@FETCH_STATUS=0    --提取成功
begin
    set @itemone=0
    set @i=0
    while @i<120
    begin
        set @m_itm=substring(@m_items,@i*10+1,10)
        --检查是否有查找的物品
        if substring(@m_itm,1,1)<>0xFF
            and (cast(substring(@m_itm,2,1) as tinyint) & 3)=3
            and (cast(substring(@m_itm,8,1) as tinyint) & 0x40)<>0
        begin
            set @m_itm=substring(@m_itm,1,1)+cast((cast(substring(@m_itm,2,1) as tinyint) & 0xFE) as binary(1))+substring(@m_itm,3,8)
            set @itemone=@itemone+1
        end
        --生成新的物品数据
        if @i<1
           set @m_ritems = @m_itm
        else
           set @m_ritems = @m_ritems+@m_itm
   
        set @i=@i+1
    end
    begin tran    --写入
        update warehouse set items=@m_ritems
            where accountid=@m_uid
    if @@error<>0
    begin
        rollback tran
    end
    else
    begin
        commit tran
    end
    fetch next from cur into @m_uid,@m_items
end
DEALLOCATE cur

--修改扩展仓库物品
declare cur CURSOR for
    select w.accountid,w.number,w.items
        from extwarehouse w
        where w.items is not null
open cur
fetch next from cur into @m_uid,@extck,@m_items
while @@FETCH_STATUS=0    --提取成功
begin
    set @itemone=0
    set @i=0
    while @i<120
    begin
        set @m_itm=substring(@m_items,@i*10+1,10)
        --检查是否有查找的物品
        if substring(@m_itm,1,1)<>0xFF
            and (cast(substring(@m_itm,2,1) as tinyint) & 3)=3
            and (cast(substring(@m_itm,8,1) as tinyint) & 0x40)<>0
        begin
            set @m_itm=substring(@m_itm,1,1)+cast((cast(substring(@m_itm,2,1) as tinyint) & 0xFE) as binary(1))+substring(@m_itm,3,8)
            set @itemone=@itemone+1
        end
        --生成新的物品数据
        if @i<1
           set @m_ritems = @m_itm
        else
           set @m_ritems = @m_ritems+@m_itm
   
        set @i=@i+1
    end
    begin tran    --写入
        update extwarehouse set items=@m_ritems
            where accountid=@m_uid and number=@extck
    if @@error<>0
    begin
        rollback tran
    end
    else
    begin
        commit tran
    end
    fetch next from cur into @m_uid,@extck,@m_items
end
DEALLOCATE cur


print '共修改 '+cast(@usercount as varchar)+' 个用户的 '+cast(@itemcount as varchar)+' 件物品 !失败用户 '+cast(@erruser as varchar)

 

set nocount off
end

新人送点
CREATE TRIGGER 新人送点 ON Character
AFTER INSERT
AS
SET NOCOUNT ON
UPDATE Character SET Character.LevelUpPoint=1234
FROM Inserted
WHERE Character.name=Inserted.name
SET NOCOUNT OFF


新人送转
CREATE TRIGGER [zscount] ON [dbo].[Character]
after Insert
as
Update [Character] set [Character].zs_count=2
From Inserted
Where Inserted.zs_count=0 and [Character].accountid=inserted.accountid
and [Character].name=inserted.name


取消新人送点:
CREATE TRIGGER [Restrict_IntLUP] ON [dbo].[Character]
after Insert
as
Update [Character] set [Character].LevelUpPoint=0 From Inserted
Where [Character].accountid=inserted.accountid
and [Character].name=inserted.name


取消送钱:

CREATE TRIGGER [取消送钱] ON [dbo].[Character]
after Insert
as
Update [Character] set [Character].money=0 From Inserted
Where [Character].money=200000

 

CREATE TRIGGER [Restrict_IntLUP_] ON [dbo].[Character]
after Insert
as
Update [Character] set [Character].money=0 From Inserted
Where [Character].accountid=inserted.accountid
and [Character].name=inserted.name

本文标签:

如需转载,请注明本文链接:http://www.598mu.com/jishu/201304033760.html



上一篇:奇迹GS汇编的一点无用的资料

下一篇:奇迹封包分析,大家参考下可以在VC中写个结构体了