Merhaba, kendi yazdığım silk ve gold event procedure paylaşıyorum. Event mantığı şu belirlediğiniz 2 itemi bağlanıyorsunuz ve bu itemlerden biri SİLK diğeri de GOLD event için.
Kullanıcılar sağ tıklayıp kullandıklarında charlarından belirttiğiniz miktarda gold veya silk düşüyor ve eventa kayıt oluyorlar.
10-5 ve 1 dakika kala kaç kişinin katıldığı kasada ne kadar gold veya silk biriktiği notice olarak geçiyor. Sonra kazanan 3 kişi kasada biriken parayı şu şekilde paylaşıyor.
Kasada biriken paranın:
1. %35 ini
2. %25 ini
3. %15 ini
kazanmış oluyor. Kalan %25 te servera gelmiş oluyor yani eriyor. Oranları kendinize göre düzenleyebilirsiniz.
PROCEDURE
TABLOLAR
Kullanıcılar sağ tıklayıp kullandıklarında charlarından belirttiğiniz miktarda gold veya silk düşüyor ve eventa kayıt oluyorlar.
10-5 ve 1 dakika kala kaç kişinin katıldığı kasada ne kadar gold veya silk biriktiği notice olarak geçiyor. Sonra kazanan 3 kişi kasada biriken parayı şu şekilde paylaşıyor.
Kasada biriken paranın:
1. %35 ini
2. %25 ini
3. %15 ini
kazanmış oluyor. Kalan %25 te servera gelmiş oluyor yani eriyor. Oranları kendinize göre düzenleyebilirsiniz.
PROCEDURE
SQL:
------------------------ Silk Jack ----------------------
DECLARE @Total int,
@OwnerQuantity1st int,
@OwnerQuantity2st int,
@OwnerQuantity3st int,
@Participation int
Select @OwnerQuantity1st = SUM (Quantity *35 /100 ) FROM SRO_VT_CREATE.._EventSilkJackLog
Select @OwnerQuantity2st = SUM (Quantity *25 / 100 ) FROM SRO_VT_CREATE.._EventSilkJackLog
Select @OwnerQuantity3st = SUM (Quantity *15 /100 ) From SRO_VT_CREATE.._EventSilkJackLog
SELECT @Total = SUM (Quantity) From SRO_VT_CREATE.._EventSilkJackLog
SELECT @Participation = COUNT (*) From SRO_VT_CREATE.._EventSilkJackLog
IF @EventName = 'SilkJack'
BEGIN
IF @Action = 'Warning1'
BEGIN
INSERT INTO MaxiGuard_User.dbo._BridgeCommands(CommandID, Executor, Data1, Data2, Date) VALUES(500, '_ProcessEvent', '6', 'Silk Jack Event 30 dakika sonra başlayacaktır. Katılan herkesin payı toplanıp 3 kişiye dağıtılacaktır.', GETDATE())
END
IF @Action = 'Warning2'
BEGIN
INSERT INTO MaxiGuard_User.dbo._BridgeCommands(CommandID, Executor, Data1, Data2, Date) VALUES(500, '_ProcessEvent', '6', 'Silk Jack Event ' + CONVERT(varchar(4), @Participation) + ' kişi ile 10 dakika sonra başlayacaktır. Toplanan silk miktarı ' + Convert (Varchar (16), @Total) +'', GETDATE())
END
IF @Action = 'Warning3'
BEGIN
INSERT INTO MaxiGuard_User.dbo._BridgeCommands(CommandID, Executor, Data1, Data2, Date) VALUES(500, '_ProcessEvent', '6', 'Silk Jack Event ' + CONVERT(varchar(4), @Participation) + ' kişi ile 5 dakika sonra başlayacaktır. Toplanan silk miktarı ' + Convert (Varchar (16), @Total) +'', GETDATE())
END
IF @Action = 'Warning4'
BEGIN
INSERT INTO MaxiGuard_User.dbo._BridgeCommands(CommandID, Executor, Data1, Data2, Date) VALUES(500, '_ProcessEvent', '6', 'Silk Jack Event ' + CONVERT(varchar(4), @Participation) + ' kişi ile 1 dakika sonra başlayacaktır. Toplanan silk miktarı ' + Convert (Varchar (16), @Total) +'', GETDATE())
END
IF @Action = 'RewardNotice'
BEGIN
DECLARE @TotalReward int,
@OwnerReward1 varchar (16),
@OwnerReward2 varchar (16),
@OwnerReward3 varchar (16)
SELECT @TotalReward = SUM ( Quantity *75 / 100 ) FROM SRO_VT_CREATE.._EventSilkJackLog
TRUNCATE TABLE SRO_VT_CREATE.._EventSilkJackPlayerNoticeLog
INSERT INTO SRO_VT_CREATE.._EventSilkJackPlayerNoticeLog (CharName)
SELECT TOP 3 CharName From SRO_VT_CREATE.._EventSilkJackLog ORDER BY NEWID ()
(SELECT @OwnerReward1 = CharName From (SELECT TOP 3 CharName, ROW_NUMBER () OVER ( ORDER BY LoginDate ) AS RowNo1 From SRO_VT_CREATE.._EventSilkJackPlayerNoticeLog) AS Tldk1 Where RowNo1 = 1)
(SELECT @OwnerReward2 = CharName From (SELECT TOP 3 CharName, ROW_NUMBER () OVER ( ORDER BY LoginDate ) AS RowNo2 From SRO_VT_CREATE.._EventSilkJackPlayerNoticeLog) AS Tldk2 Where RowNo2 = 2)
(SELECT @OwnerReward3 = CharName From (SELECT TOP 3 CharName, ROW_NUMBER () OVER ( ORDER BY LoginDate ) AS RowNo3 From SRO_VT_CREATE.._EventSilkJackPlayerNoticeLog) AS Tldk3 Where RowNo3 = 3)
INSERT INTO MaxiGuard_User.dbo._BridgeCommands(CommandID, Executor, Data1, Data2, Date) VALUES(500, '_ProcessEvent', '6', 'Silk Jack Event ' + CONVERT(varchar(4), @Participation) + ' Katılım Sonucu ' + Convert (Varchar (16), @Total) +' Silk ödülünün ' + Convert (Varchar (16), @TotalReward) +' miktarı ' + @OwnerReward1 +', ' + @OwnerReward2 +', ' + @OwnerReward3 +' kazananlarına dağıtılacaktır. ', GETDATE())
END
IF @Action = 'Reward'
BEGIN
DECLARE @OwnerReward#1 varchar (16),
@OwnerReward#2 varchar (16),
@OwnerReward#3 varchar (16)
(SELECT @OwnerReward#1 = CharName From ( Select Top 3 CharName, ROW_NUMBER () OVER ( ORDER BY LoginDate) As RowNo#1 From SRO_VT_CREATE.._EventSilkJackPlayerNoticeLog) AS ddwe1 Where RowNo#1 = 1)
(SELECT @OwnerReward#2 = CharName From ( Select Top 3 CharName, Row_NUMBER () OVER ( Order By LoginDate) As RowNo#2 From SRO_VT_CREATE.._EventSilkJackPlayerNoticeLog) As ddwe2 Where RowNo#2 = 2)
(SELECT @OwnerReward#3 = CharName FROM ( Select TOP 3 CharName, ROW_NUMBER () OVER ( ORDER BY LoginDate ) AS RowNo#3 From SRO_VT_CREATE.._EventSilkJackPlayerNoticeLog ) AS ddw3 Where RowNo#3 = 3)
INSERT INTO MaxiGuard_User.dbo._BridgeCommands(CommandID, Executor, Data1, Data2, Date) VALUES(500, '_ProcessEvent', '6', ' #1st ' + '[' + CONVERT (varchar (16), @OwnerReward#1 ) + ']' + ' = |' + CONVERT (varchar (16), @OwnerQuantity1st) + '| silk #2st ' + '[' + CONVERT (varchar (16), @OwnerReward#2) + ']' + ' = |' + CONVERT (varchar (16), @OwnerQuantity2st ) + '| Silk #3st '+ '[' + CONVERT (Varchar (16), @OwnerReward#3 ) + ']' + ' = |' + CONVERT (varchar (16), @OwnerQuantity3st ) + '| ', GETDATE())
INSERT INTO MaxiGUard_User.dbo._BridgeCommands (CommandID, Executor, Data1, Data2, Data3, Date) VALUES(56, 'LogDB', ''+ Convert (varchar (16), @OwnerQuantity1st ) +'', '0' , ''+ Convert (varchar (16), @OwnerReward#1 ) +'', GETDATE())
INSERT INTO MaxiGUard_User.dbo._BridgeCommands (CommandID, Executor, Data1, Data2, Data3, Date) VALUES(56, 'LogDB', ''+ Convert (varchar (16), @OwnerQuantity2st ) +'', '0' , ''+ Convert (varchar (16), @OwnerReward#2 ) +'', GETDATE())
INSERT INTO MaxiGUard_User.dbo._BridgeCommands (CommandID, Executor, Data1, Data2, Data3, Date) VALUES(56, 'LogDB', ''+ Convert (varchar (16), @OwnerQuantity3st ) +'', '0' , ''+ Convert (varchar (16), @OwnerReward#3 ) +'', GETDATE())
END
END
------------------------ Gold Jack ----------------------
DECLARE @TotalGold int,
@OwnerGoldQuantity1st int,
@OwnerGoldQuantity2st int,
@OwnerGoldQuantity3st int,
@ParticipationGoldLogin int
Select @OwnerGoldQuantity1st = SUM (Quantity *35 /100 ) FROM SRO_VT_CREATE.._EventGoldJackLog
Select @OwnerGoldQuantity2st = SUM (Quantity *25 / 100 ) FROM SRO_VT_CREATE.._EventGoldJackLog
Select @OwnerGoldQuantity3st = SUM (Quantity *15 /100 ) From SRO_VT_CREATE.._EventGoldJackLog
SELECT @TotalGold = SUM (Quantity) From SRO_VT_CREATE.._EventGoldJackLog
SELECT @ParticipationGoldLogin = COUNT (*) From SRO_VT_CREATE.._EventGoldJackLog
IF @EventName = 'GoldJack'
BEGIN
IF @Action = 'Warning1'
BEGIN
INSERT INTO MaxiGuard_User.dbo._BridgeCommands(CommandID, Executor, Data1, Data2, Date) VALUES(500, '_ProcessEvent', '6', 'Gold Jack Event 30 dakika sonra başlayacaktır. Katılan herkesin payı toplanıp 3 kişiye dağıtılacaktır.', GETDATE())
END
IF @Action = 'Warning2'
BEGIN
INSERT INTO MaxiGuard_User.dbo._BridgeCommands(CommandID, Executor, Data1, Data2, Date) VALUES(500, '_ProcessEvent', '6', 'Gold Jack Event ' + CONVERT(varchar(4), @ParticipationGoldLogin) + ' kişi ile 10 dakika sonra başlayacaktır. Toplanan Gold miktarı ' + Convert (Varchar (16), @TotalGold) +'', GETDATE())
END
IF @Action = 'Warning3'
BEGIN
INSERT INTO MaxiGuard_User.dbo._BridgeCommands(CommandID, Executor, Data1, Data2, Date) VALUES(500, '_ProcessEvent', '6', 'Gold Jack Event ' + CONVERT(varchar(4), @ParticipationGoldLogin) + ' kişi ile 5 dakika sonra başlayacaktır. Toplanan Gold miktarı ' + Convert (Varchar (16), @TotalGold) +'', GETDATE())
END
IF @Action = 'Warning4'
BEGIN
INSERT INTO MaxiGuard_User.dbo._BridgeCommands(CommandID, Executor, Data1, Data2, Date) VALUES(500, '_ProcessEvent', '6', 'Gold Jack Event ' + CONVERT(varchar(4), @ParticipationGoldLogin) + ' kişi ile 1 dakika sonra başlayacaktır. Toplanan Gold miktarı ' + Convert (Varchar (16), @TotalGold) +'', GETDATE())
END
IF @Action = 'RewardNotice'
BEGIN
DECLARE @TotalGoldReward int,
@OwnerGoldReward1 varchar (16),
@OwnerGoldReward2 varchar (16),
@OwnerGoldReward3 varchar (16)
SELECT @TotalGoldReward = SUM ( Quantity *75 / 100 ) FROM SRO_VT_CREATE.._EventGoldJackLog
TRUNCATE TABLE SRO_VT_CREATE.._EventGoldJackPlayerNoticeLog
INSERT INTO SRO_VT_CREATE.._EventGoldJackPlayerNoticeLog (CharName)
SELECT TOP 3 CharName From SRO_VT_CREATE.._EventGoldJackLog ORDER BY NEWID ()
(SELECT @OwnerGoldReward1 = CharName From (SELECT TOP 3 CharName, ROW_NUMBER () OVER ( ORDER BY LoginDate ) AS RowNo1 From SRO_VT_CREATE.._EventGoldJackPlayerNoticeLog) AS Tldk1 Where RowNo1 = 1)
(SELECT @OwnerGoldReward2 = CharName From (SELECT TOP 3 CharName, ROW_NUMBER () OVER ( ORDER BY LoginDate ) AS RowNo2 From SRO_VT_CREATE.._EventGoldJackPlayerNoticeLog) AS Tldk2 Where RowNo2 = 2)
(SELECT @OwnerGoldReward3 = CharName From (SELECT TOP 3 CharName, ROW_NUMBER () OVER ( ORDER BY LoginDate ) AS RowNo3 From SRO_VT_CREATE.._EventGoldJackPlayerNoticeLog) AS Tldk3 Where RowNo3 = 3)
INSERT INTO MaxiGuard_User.dbo._BridgeCommands(CommandID, Executor, Data1, Data2, Date) VALUES(500, '_ProcessEvent', '6', 'Gold Jack Event ' + CONVERT(varchar(4), @ParticipationGoldLogin) + ' Katılım Sonucu ' + Convert (Varchar (16), @TotalGold) +' Gold ödülünün ' + Convert (Varchar (16), @TotalGoldReward) +' miktarı ' + @OwnerGoldReward1 +', ' + @OwnerGoldReward2 +', ' + @OwnerGoldReward3 +' kazananlarına dağıtılacaktır. ', GETDATE())
END
IF @Action = 'Reward'
BEGIN
DECLARE @OwnerGoldReward#1 varchar (16),
@OwnerGoldReward#2 varchar (16),
@OwnerGoldReward#3 varchar (16)
(SELECT @OwnerGoldReward#1 = CharName From ( Select Top 3 CharName, ROW_NUMBER () OVER ( ORDER BY LoginDate) As RowNo#1 From SRO_VT_CREATE.._EventGoldJackPlayerNoticeLog) AS ddwe1 Where RowNo#1 = 1)
(SELECT @OwnerGoldReward#2 = CharName From ( Select Top 3 CharName, Row_NUMBER () OVER ( Order By LoginDate) As RowNo#2 From SRO_VT_CREATE.._EventGoldJackPlayerNoticeLog) As ddwe2 Where RowNo#2 = 2)
(SELECT @OwnerGoldReward#3 = CharName FROM ( Select TOP 3 CharName, ROW_NUMBER () OVER ( ORDER BY LoginDate ) AS RowNo#3 From SRO_VT_CREATE.._EventGoldJackPlayerNoticeLog ) AS ddw3 Where RowNo#3 = 3)
INSERT INTO MaxiGuard_User.dbo._BridgeCommands(CommandID, Executor, Data1, Data2, Date) VALUES(500, '_ProcessEvent', '6', ' #1st ' + '[' + CONVERT (varchar (16), @OwnerGoldReward#1 ) + ']' + ' = |' + CONVERT (varchar (16), @OwnerGoldQuantity1st) + '| Gold #2st ' + '[' + CONVERT (varchar (16), @OwnerGoldReward#2) + ']' + ' = |' + CONVERT (varchar (16), @OwnerGoldQuantity2st ) + '| Gold #3st '+ '[' + CONVERT (Varchar (16), @OwnerGoldReward#3 ) + ']' + ' = |' + CONVERT (varchar (16), @OwnerGoldQuantity3st ) + '| ', GETDATE())
INSERT INTO MaxiGUard_User.dbo._BridgeCommands (CommandID, Executor, Data1, Data2, Data3, Date) VALUES(56, 'LogDB', ''+ Convert (varchar (16), @OwnerGoldQuantity1st ) +'', '0' , ''+ Convert (varchar (16), @OwnerGoldReward#1 ) +'', GETDATE())
INSERT INTO MaxiGUard_User.dbo._BridgeCommands (CommandID, Executor, Data1, Data2, Data3, Date) VALUES(56, 'LogDB', ''+ Convert (varchar (16), @OwnerGoldQuantity2st ) +'', '0' , ''+ Convert (varchar (16), @OwnerGoldReward#2 ) +'', GETDATE())
INSERT INTO MaxiGUard_User.dbo._BridgeCommands (CommandID, Executor, Data1, Data2, Data3, Date) VALUES(56, 'LogDB', ''+ Convert (varchar (16), @OwnerGoldQuantity3st ) +'', '0' , ''+ Convert (varchar (16), @OwnerGoldReward#3 ) +'', GETDATE())
END
END
TABLOLAR
SQL:
USE [SRO_VT_CREATE]
GO
CREATE TABLE [dbo].[_EventGoldJackLog](
[CharID] [int] NULL,
[CharName] [varchar](32) NULL,
[Quantity] [int] NULL,
[LoginDate] [date] NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[_EventGoldJackPlayerNoticeLog](
[CharName] [varchar](32) NULL,
[LoginDate] [date] NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[_EventSilkJackLog](
[CharID] [int] NULL,
[CharName] [varchar](32) NULL,
[Quantity] [int] NULL,
[LoginDate] [date] NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[_EventSilkJackPlayerNoticeLog](
[CharName] [varchar](32) NULL,
[LoginDate] [date] NULL
) ON [PRIMARY]
GO