المشاركة الأصلية كتبت بواسطة Mission SRO
عفوا ,,, لايمكنك مشاهده الروابط لانك غير مسجل لدينا [ للتسجيل اضغط هنا ]
مساكو فل يا رجاله
انا عملت النظام
ا فى السيرفر بتاعى ولاحظت ان فى ناس كتير بتسأل عليه
فا انا فكرت فيه وقلت انزلو علشان خاطر الاعضاء
كل اللى هتعملو انك هتعمل نظام Silk Per Hour عادى خالص
وتحط دى مكان addlogchar يتاعت Silk Per Hour System
الليفل هوا اللى بالون الاحمر علشان لو حبيت تغيروه
كود PHP:
IF (@CharID IN (select charid from SRO_VT_SHARD.dbo._User with (nolock) where UserJID in (select JID from SRO_VT_ACCOUNT.dbo.TB_User with (nolock) where sec_content = 3)) and exists (Select * from SRO_VT_SHARD.dbo._Char where CurLevel = '120' and CharID = @charid) and not exists (SELECT CharID FROM _OnlineOffline WHERE CharID = @CharID) ) BEGIN
INSERT INTO _OnlineOffline (CharID, Charname, [Status], [Date], [Minutes], [tMinutes], eSilk, mOnline, [Silk/Hour], [stillOnline@]) VALUES ( @CharID, (SELECT CharName16 FROM SRO_VT_SHARD.dbo._Char WHERE CharID = @CharID), 'OnHold', GETDATE(), 0,0,0, NULL,(SELECT DefaultSilk FROM [_Silk/Hour-Config] WHERE [Desc] like 'Rates'), NULL ); END
IF (@EventID = 4 OR @EventID = 6) BEGIN
IF (@EventID = 6 AND ((SELECT [Status] FROM _OnlineOffline WHERE CharID = @CharID) like 'OnHold')) BEGIN UPDATE _OnlineOffline SET [Status] = 'Offline' WHERE CharID = @CharID END
IF (@EventID = 6 AND ((SELECT [Status] FROM _OnlineOffline WHERE CharID = @CharID) like 'Online')) BEGIN UPDATE _OnlineOffline SET [Status] = 'Offline', [Minutes] = [Minutes] + (DATEDIFF(MINUTE,[stillOnline@],GETDATE())), [tMinutes] = [tMinutes] + (DATEDIFF(MINUTE,[stillOnline@],GETDATE())), [mOnline] = NULL, [stillOnline@] = NULL WHERE CharID = @CharID END
IF (@EventID = 4) BEGIN UPDATE _OnlineOffline SET [Status] = 'Online', [Date] = GETDATE(), [stillOnline@] = GETDATE() WHERE CharID = @CharID END END
UPDATE _OnlineOffline SET [mOnline] = CAST((DATEDIFF(MINUTE,[Date],GETDATE()))as varchar(max)) + ' minute(s) Online', [Minutes] = [Minutes] + (DATEDIFF(MINUTE,[stillOnline@],GETDATE())), [tMinutes] = [tMinutes] + (DATEDIFF(MINUTE,[stillOnline@],GETDATE())), [stillOnline@] = GETDATE() WHERE [Status] like 'Online'
/*Silk/Hour basic calc*/ IF ((SELECT [tMinutes] from _OnlineOffline WHERE CharID = @CharID) >= (SELECT [Step1Silk] FROM [_Silk/Hour-Config] WHERE [Desc] like 'Requirements')) BEGIN Declare @sph int; exec @sph = [_GetSilkperHour] @CharID UPDATE _OnlineOffline SET [Silk/Hour] = @sph WHERE CharID = @CharID END /*!Silk/Hour basic calc*/
IF (((SELECT NextDate FROM [_RandomPlayer&Date] WHERE [Desc] like 'Next') IS NULL)) BEGIN DECLARE @FirstDate datetime, @Today datetime = GETDATE(), @FirstCharID int;
UPDATE [_RandomPlayer&Date] SET NextDate = @FirstDate, RefreshedDate = GETDATE(), CharID = @FirstCharID, Charname = (SELECT CharName16 FROM SRO_VT_SHARD.dbo._Char WHERE CharID = @FirstCharID) WHERE [Desc] like 'Next'; END
IF ((SELECT NextDate FROM [_RandomPlayer&Date] WHERE [Desc] like 'Next') <= GETDATE()) BEGIN UPDATE _OnlineOffline SET [Silk/Hour] = (SELECT RewardSilk FROM [_Silk/Hour-Config] WHERE [Desc] like 'Rates') WHERE CharID = (SELECT CharID FROM [_RandomPlayer&Date] WHERE [Desc] like 'Next'); Declare @CurSilkperHour int, @OldCharID int = (SELECT CharID FROM [_RandomPlayer&Date] WHERE [Desc] like 'Current'); IF (@OldCharID IS NOT NULL) BEGIN exec @CurSilkperHour = _GetSilkperHour @OldCharID UPDATE _OnlineOffline SET [Silk/Hour] = @CurSilkperHour WHERE CharID = @OldCharID; END UPDATE [_RandomPlayer&Date] SET NextDate = NULL, RefreshedDate = GETDATE(), CharID = (SELECT CharID FROM [_RandomPlayer&Date] WHERE [Desc] like 'Next'), Charname = (SELECT Charname FROM [_RandomPlayer&Date] WHERE [Desc] like 'Next') WHERE [Desc] like 'Current'
/*new Random Time of Today+1*/ DECLARE @NextDate datetime, @Tomorrow datetime = GETDATE()+1, @NewCharID int;
UPDATE [_RandomPlayer&Date] SET NextDate = @NextDate, RefreshedDate = GETDATE(), CharID = @NewCharID, Charname = (SELECT CharName16 FROM SRO_VT_SHARD.dbo._Char WHERE CharID = @NewCharID) WHERE [Desc] like 'Next' /*!new Random...*/ END
/*Calculation of the silk amount*/ Declare @tMinutes bigint = (SELECT [Minutes] from _OnlineOffline WHERE CharID = @CharID), @Silk int;
IF (@tMinutes >= 60) BEGIN SET @Silk = CAST(((SELECT [Minutes] FROM _OnlineOffline WHERE CharID = @CharID) / 60) as int) UPDATE _OnlineOffline SET [Minutes] = [Minutes] % 60 WHERE CharID = @CharID
IF exists (SELECT [WEEKDAYS] FROM [_Silk/Hour-Config] WHERE [WEEKDAYS] like DATENAME(WEEKDAY, GETDATE())) BEGIN UPDATE _OnlineOffline SET [eSilk] = [eSilk] + (@Silk*[Silk/Hour]) WHERE CharID = @CharID
exec SRO_VT_ACCOUNT.dbo._extraSilk @CharID, @Silk END END