Mentor
06/01/2017, 11:04 PM
essa trigger faz contagem de ranking de PK e Hero, que conta os kills com mais precisão.
Sem mais enrolação:
♦ Versão atual do Script:
- TRIGGER: 1.0.0
♦ ALTER TABLES
USE [MUOnline]
GO
ALTER TABLE [dbo].[Character]
ADD [PkCountDay] [INT] DEFAULT ((0)) NOT NULL
GO
ALTER TABLE [dbo].[Character]
ADD [PkCountWeek] [INT] DEFAULT ((0)) NOT NULL
GO
ALTER TABLE [dbo].[Character]
ADD [PkCountMonth] [INT] DEFAULT ((0)) NOT NULL
GO
ALTER TABLE [dbo].[Character]
ADD [PkCountTotal] [INT] DEFAULT ((0)) NOT NULL
GO
ALTER TABLE [dbo].[Character]
ADD [HeroCount] [INT] DEFAULT ((0)) NOT NULL
GO
ALTER TABLE [dbo].[Character]
ADD [HeroCountDay] [INT] DEFAULT ((0)) NOT NULL
GO
ALTER TABLE [dbo].[Character]
ADD [HeroCountWeek] [INT] DEFAULT ((0)) NOT NULL
GO
ALTER TABLE [dbo].[Character]
ADD [HeroCountMonth] [INT] DEFAULT ((0)) NOT NULL
GO
♦ TRIGGER - RankingHeroPK
/*
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
*/
USE MuOnline
GO
IF EXISTS (SELECT name FROM sysobjects WHERE name = 'RankingHeroPK' AND type = 'TR')
DROP TRIGGER [RankingHeroPK]
GO
CREATE TRIGGER [dbo].[RankingHeroPK]
ON [dbo].[Character]
AFTER UPDATE AS
SET NOCOUNT ON
IF UPDATE(PkCount)
BEGIN SET NOCOUNT ON;
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
UPDATE [Character] SET
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
ELSE BEGIN
UPDATE [Character] SET
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
END
SET NOCOUNT OFF
END
Criem as Jobs manualmente igual ranking de resets diário, semanal e mensal... Precisam ser zerados.
UPDATE Character SET PkCountDay = 0
UPDATE Character SET PkCountWeek = 0
UPDATE Character SET PkCountMonth = 0
UPDATE Character SET HeroCountDay = 0
UPDATE Character SET HeroCountWeek = 0
UPDATE Character SET HeroCountMonth = 0
ATENÇÃO
Não me responsabilizo por uso incorreto.
Não me responsabilizo por eventuais deadlocks. Usem por conta e risco.
Créditos:
Renato
Sem mais enrolação:
♦ Versão atual do Script:
- TRIGGER: 1.0.0
♦ ALTER TABLES
USE [MUOnline]
GO
ALTER TABLE [dbo].[Character]
ADD [PkCountDay] [INT] DEFAULT ((0)) NOT NULL
GO
ALTER TABLE [dbo].[Character]
ADD [PkCountWeek] [INT] DEFAULT ((0)) NOT NULL
GO
ALTER TABLE [dbo].[Character]
ADD [PkCountMonth] [INT] DEFAULT ((0)) NOT NULL
GO
ALTER TABLE [dbo].[Character]
ADD [PkCountTotal] [INT] DEFAULT ((0)) NOT NULL
GO
ALTER TABLE [dbo].[Character]
ADD [HeroCount] [INT] DEFAULT ((0)) NOT NULL
GO
ALTER TABLE [dbo].[Character]
ADD [HeroCountDay] [INT] DEFAULT ((0)) NOT NULL
GO
ALTER TABLE [dbo].[Character]
ADD [HeroCountWeek] [INT] DEFAULT ((0)) NOT NULL
GO
ALTER TABLE [dbo].[Character]
ADD [HeroCountMonth] [INT] DEFAULT ((0)) NOT NULL
GO
♦ TRIGGER - RankingHeroPK
/*
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
*/
USE MuOnline
GO
IF EXISTS (SELECT name FROM sysobjects WHERE name = 'RankingHeroPK' AND type = 'TR')
DROP TRIGGER [RankingHeroPK]
GO
CREATE TRIGGER [dbo].[RankingHeroPK]
ON [dbo].[Character]
AFTER UPDATE AS
SET NOCOUNT ON
IF UPDATE(PkCount)
BEGIN SET NOCOUNT ON;
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
UPDATE [Character] SET
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
ELSE BEGIN
UPDATE [Character] SET
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
[Only registered and activated users can see links]
END
SET NOCOUNT OFF
END
Criem as Jobs manualmente igual ranking de resets diário, semanal e mensal... Precisam ser zerados.
UPDATE Character SET PkCountDay = 0
UPDATE Character SET PkCountWeek = 0
UPDATE Character SET PkCountMonth = 0
UPDATE Character SET HeroCountDay = 0
UPDATE Character SET HeroCountWeek = 0
UPDATE Character SET HeroCountMonth = 0
ATENÇÃO
Não me responsabilizo por uso incorreto.
Não me responsabilizo por eventuais deadlocks. Usem por conta e risco.
Créditos:
Renato