Amaç : Castle Siege War'ı Canlandırmak ve Beraberin de Kale Sahibi Clanın Üyelerine Hergün Belirtilen Miktardaki NP yi Oyuna Girsin veya Girmesin Vermek.
Ben Şuanda 25 Olarak Ayarladım
SET @AddedLoyalty = 25
Query Anaylizer de Uygulanacak Kod.
Kod:
ALTERTABLE USERDATA ADD CSWFreeLoyaltyUpdateTime smalldatetimeNULL
UPDATE USERDATA SET CSWFreeLoyaltyUpdateTime =NULL
Query Anaylizer de Uygulanacak Kod.
Kod:
CREATE PROCEDURE [dbo].[LOAD_KNIGHTS_SIEGE_WARFARE_USERS]
@strUserId char(25)
AS
/*
Author : AKUMA
Update : 25.10.2009 - 14:23
*/
DECLARE @Knights smallint
DECLARE @MasterKnightsID smallint
DECLARE @CSWFreeLoyaltyUpdateTime datetime
DECLARE @AddedLoyalty int
DECLARE @IsOnline tinyint
SET @AddedLoyalty = 25
SELECT @Knights = Knights FROM USERDATA WHERE strUserId = @strUserId
SELECT @MasterKnightsID = sMasterKnights FROM KNIGHTS_SIEGE_WARFARE WHERE sCastleIndex = 1
IF (@Knights <> 0) AND (@Knights = @MasterKnightsID)
BEGIN
SELECT @CSWFreeLoyaltyUpdateTime = CSWFreeLoyaltyUpdateTime FROM USERDATA WHERE strUserId = @strUserId
IF DATEDIFF(day,@CSWFreeLoyaltyUpdateTime,GETDATE()) >= 1
UPDATE USERDATA SET Loyalty = Loyalty + @AddedLoyalty,CSWFreeLoyaltyUpdateTime = GETDATE() WHERE strUserId = @strUserId
ELSE IF @CSWFreeLoyaltyUpdateTime IS NULL
UPDATE USERDATA SET Loyalty = Loyalty + @AddedLoyalty,CSWFreeLoyaltyUpdateTime = GETDATE() WHERE strUserId = @strUserId
DECLARE KSWU_CURSOR CURSOR FOR
SELECT strUserId FROM USERDATA WHERE Knights = @MasterKnightsID
OPEN KSWU_CURSOR
FETCH NEXT FROM KSWU_CURSOR INTO @strUserId
WHILE @@FETCH_STATUS = 0
BEGIN
SET @CSWFreeLoyaltyUpdateTime = 0
SET @IsOnline = 0
SELECT @IsOnline = COUNT(strCharID) FROM CURRENTUSER WHERE strCharID = @strUserId
IF @IsOnline = 0
BEGIN
SELECT @CSWFreeLoyaltyUpdateTime = CSWFreeLoyaltyUpdateTime FROM USERDATA WHERE strUserId = @strUserId
IF DATEDIFF(day,@CSWFreeLoyaltyUpdateTime,GETDATE()) >= 1
UPDATE USERDATA SET Loyalty = Loyalty + @AddedLoyalty,CSWFreeLoyaltyUpdateTime = GETDATE() WHERE strUserId = @strUserId
ELSE IF @CSWFreeLoyaltyUpdateTime IS NULL
UPDATE USERDATA SET Loyalty = Loyalty + @AddedLoyalty,CSWFreeLoyaltyUpdateTime = GETDATE() WHERE strUserId = @strUserId
END
FETCH NEXT FROM KSWU_CURSOR INTO @strUserId
END
CLOSE KSWU_CURSOR
DEALLOC
LOAD_USER_DATA'ya Eklenecek Kod...
Kod:
EXEC LOAD_KNIGHTS_SIEGE_WARFARE_USERS@strUserId
Ben Şuanda 25 Olarak Ayarladım
SET @AddedLoyalty = 25
Query Anaylizer de Uygulanacak Kod.
Kod:
ALTERTABLE USERDATA ADD CSWFreeLoyaltyUpdateTime smalldatetimeNULL
UPDATE USERDATA SET CSWFreeLoyaltyUpdateTime =NULL
Query Anaylizer de Uygulanacak Kod.
Kod:
CREATE PROCEDURE [dbo].[LOAD_KNIGHTS_SIEGE_WARFARE_USERS]
@strUserId char(25)
AS
/*
Author : AKUMA
Update : 25.10.2009 - 14:23
*/
DECLARE @Knights smallint
DECLARE @MasterKnightsID smallint
DECLARE @CSWFreeLoyaltyUpdateTime datetime
DECLARE @AddedLoyalty int
DECLARE @IsOnline tinyint
SET @AddedLoyalty = 25
SELECT @Knights = Knights FROM USERDATA WHERE strUserId = @strUserId
SELECT @MasterKnightsID = sMasterKnights FROM KNIGHTS_SIEGE_WARFARE WHERE sCastleIndex = 1
IF (@Knights <> 0) AND (@Knights = @MasterKnightsID)
BEGIN
SELECT @CSWFreeLoyaltyUpdateTime = CSWFreeLoyaltyUpdateTime FROM USERDATA WHERE strUserId = @strUserId
IF DATEDIFF(day,@CSWFreeLoyaltyUpdateTime,GETDATE()) >= 1
UPDATE USERDATA SET Loyalty = Loyalty + @AddedLoyalty,CSWFreeLoyaltyUpdateTime = GETDATE() WHERE strUserId = @strUserId
ELSE IF @CSWFreeLoyaltyUpdateTime IS NULL
UPDATE USERDATA SET Loyalty = Loyalty + @AddedLoyalty,CSWFreeLoyaltyUpdateTime = GETDATE() WHERE strUserId = @strUserId
DECLARE KSWU_CURSOR CURSOR FOR
SELECT strUserId FROM USERDATA WHERE Knights = @MasterKnightsID
OPEN KSWU_CURSOR
FETCH NEXT FROM KSWU_CURSOR INTO @strUserId
WHILE @@FETCH_STATUS = 0
BEGIN
SET @CSWFreeLoyaltyUpdateTime = 0
SET @IsOnline = 0
SELECT @IsOnline = COUNT(strCharID) FROM CURRENTUSER WHERE strCharID = @strUserId
IF @IsOnline = 0
BEGIN
SELECT @CSWFreeLoyaltyUpdateTime = CSWFreeLoyaltyUpdateTime FROM USERDATA WHERE strUserId = @strUserId
IF DATEDIFF(day,@CSWFreeLoyaltyUpdateTime,GETDATE()) >= 1
UPDATE USERDATA SET Loyalty = Loyalty + @AddedLoyalty,CSWFreeLoyaltyUpdateTime = GETDATE() WHERE strUserId = @strUserId
ELSE IF @CSWFreeLoyaltyUpdateTime IS NULL
UPDATE USERDATA SET Loyalty = Loyalty + @AddedLoyalty,CSWFreeLoyaltyUpdateTime = GETDATE() WHERE strUserId = @strUserId
END
FETCH NEXT FROM KSWU_CURSOR INTO @strUserId
END
CLOSE KSWU_CURSOR
DEALLOC
LOAD_USER_DATA'ya Eklenecek Kod...
Kod:
EXEC LOAD_KNIGHTS_SIEGE_WARFARE_USERS@strUserId