[SQL] auto free Silk/Hour based on the Online time (System)

Page 6 of 10 FirstFirst 12345678910 LastLast
Results 76 to 90 of 145
  1. #76
    Proficient Member Dragonzee is offline
    MemberRank
    Oct 2011 Join Date
    Bashtil, Al JizLocation
    161Posts

    Re: [SQL] auto free Silk/Hour based on the Online time (System)

    its a clue of whats means in the query

    hmm guys

    did any one knows the way to make a level requirement to start this system

    example : creddy Loki making from 60+ this system work

  2. #77
    Apprentice capovip is offline
    MemberRank
    Jan 2012 Join Date
    23Posts

    Re: [SQL] auto free Silk/Hour based on the Online time (System)

    thnxxxxx

  3. #78
    Pure Nightmare Jason1990 is offline
    MemberRank
    Jul 2012 Join Date
    GermanyLocation
    311Posts

    Re: [SQL] auto free Silk/Hour based on the Online time (System)

    All working fine =) Gained silk after relogging your char and it's easy to change the Silk per hour or the time when it gives more then 1 silk :)

    I've change it to "Start => 3 Silk"
    After 24H => 4Silk/h
    after 7Days => 5 Silk/h

    it's realy easy and working great :) thanks for all :)

  4. #79
    #Yummi.sql Caipi is offline
    MemberRank
    Sep 2011 Join Date
    GermanyLocation
    403Posts

    Re: [SQL] auto free Silk/Hour based on the Online time (System)

    Quote Originally Posted by Dragonzee View Post
    its a clue of whats means in the query

    hmm guys

    did any one knows the way to make a level requirement to start this system

    example : creddy Loki making from 60+ this system work
    @ _AddLogChar :)


    from

    PHP Code:
        IF exists (SELECT [WEEKDAYSFROM [_Silk/Hour-ConfigWHERE [WEEKDAYSlike DATENAME(WEEKDAYGETDATE()))
            
    BEGIN
                UPDATE _OnlineOffline
                SET 
    [eSilk] = [eSilk] + (@Silk*[Silk/Hour])
                
    WHERE CharID = @CharID
                        
                exec SRO_VT_ACCOUNT
    .dbo._extraSilk @CharID, @Silk
            END 
    to »

    PHP Code:
    IF exists (SELECT [WEEKDAYSFROM [_Silk/Hour-ConfigWHERE [WEEKDAYS] = DATENAME(WEEKDAYGETDATE()))
        
    BEGIN
            
    Declare @CurLevel smallint;
            
    SELECT @CurLevel CurLevel FROM SRO_VT_SHARD.dbo._Char with(NOLOCKWHERE CharID = @CharID
            
            
    IF (@CurLevel >= 60)
                
    BEGIN
                    UPDATE _OnlineOffline
                    SET 
    [eSilk] = ISNULL([eSilk],0) + (@Silk*[Silk/Hour])
                    
    WHERE CharID = @CharID
                        
                    exec SRO_VT_ACCOUNT
    .dbo._extraSilk @CharID, @Silk
                END
        END 

  5. #80
    Proficient Member Dragonzee is offline
    MemberRank
    Oct 2011 Join Date
    Bashtil, Al JizLocation
    161Posts

    Re: [SQL] auto free Silk/Hour based on the Online time (System)

    well thanks for help me caipi

    but there a problem

    if i executed the query as u wrote it will says

    Msg 102, Level 15, State 1, Procedure _AddLogChar, Line 191
    Incorrect syntax near 'END'.


    and by tracing the problem if i deleted

    PHP Code:
            IF (@CurLevel >= 60)
                
    BEGIN
                    UPDATE _OnlineOffline 
    if i deleted BEGIN it will success
    if i put it its get that problem

    well iam not good in SQL

    but do u know any solution ?

  6. #81
    Novice carmenjason is offline
    MemberRank
    Oct 2012 Join Date
    3Posts

    Re: [SQL] auto free Silk/Hour based on the Online time (System)

    errors :(

    Msg 102, Level 15, State 1, Procedure _GetSilkperHour, Line 8
    Incorrect syntax near '('.
    Msg 102, Level 15, State 1, Procedure _GetSilkperHour, Line 8
    Incorrect syntax near ','.
    Msg 137, Level 15, State 2, Procedure _GetSilkperHour, Line 13
    Must declare the scalar variable "@totalMinutes".
    Msg 156, Level 15, State 1, Procedure _GetSilkperHour, Line 14
    Incorrect syntax near the keyword 'THEN'.
    Msg 156, Level 15, State 1, Procedure _GetSilkperHour, Line 15
    Incorrect syntax near the keyword 'WHEN'.
    Msg 156, Level 15, State 1, Procedure _GetSilkperHour, Line 16
    Incorrect syntax near the keyword 'THEN'.
    Msg 156, Level 15, State 1, Procedure _GetSilkperHour, Line 17
    Incorrect syntax near the keyword 'WHEN'.
    Msg 156, Level 15, State 1, Procedure _GetSilkperHour, Line 18
    Incorrect syntax near the keyword 'THEN'.
    Msg 156, Level 15, State 1, Procedure _GetSilkperHour, Line 19
    Incorrect syntax near the keyword 'ELSE'.
    Msg 156, Level 15, State 1, Procedure _GetSilkperHour, Line 22
    Incorrect syntax near the keyword 'RETURN'.
    Msg 137, Level 15, State 2, Procedure _GetSilkperHour, Line 22
    Must declare the scalar variable "@Silkoutput".

    --------------------

    Msg 156, Level 15, State 1, Procedure _GetRandomTime, Line 14
    Incorrect syntax near the keyword 'CONVERT'.
    Msg 137, Level 15, State 2, Procedure _GetRandomTime, Line 19
    Must declare the scalar variable "@BasicDate".

    only first 3 queries worked

  7. #82
    Proficient Member Dragonzee is offline
    MemberRank
    Oct 2011 Join Date
    Bashtil, Al JizLocation
    161Posts

    Re: [SQL] auto free Silk/Hour based on the Online time (System)

    Quote Originally Posted by carmenjason View Post
    errors :(

    Msg 102, Level 15, State 1, Procedure _GetSilkperHour, Line 8
    Incorrect syntax near '('.
    Msg 102, Level 15, State 1, Procedure _GetSilkperHour, Line 8
    Incorrect syntax near ','.
    Msg 137, Level 15, State 2, Procedure _GetSilkperHour, Line 13
    Must declare the scalar variable "@totalMinutes".
    Msg 156, Level 15, State 1, Procedure _GetSilkperHour, Line 14
    Incorrect syntax near the keyword 'THEN'.
    Msg 156, Level 15, State 1, Procedure _GetSilkperHour, Line 15
    Incorrect syntax near the keyword 'WHEN'.
    Msg 156, Level 15, State 1, Procedure _GetSilkperHour, Line 16
    Incorrect syntax near the keyword 'THEN'.
    Msg 156, Level 15, State 1, Procedure _GetSilkperHour, Line 17
    Incorrect syntax near the keyword 'WHEN'.
    Msg 156, Level 15, State 1, Procedure _GetSilkperHour, Line 18
    Incorrect syntax near the keyword 'THEN'.
    Msg 156, Level 15, State 1, Procedure _GetSilkperHour, Line 19
    Incorrect syntax near the keyword 'ELSE'.
    Msg 156, Level 15, State 1, Procedure _GetSilkperHour, Line 22
    Incorrect syntax near the keyword 'RETURN'.
    Msg 137, Level 15, State 2, Procedure _GetSilkperHour, Line 22
    Must declare the scalar variable "@Silkoutput".

    --------------------

    Msg 156, Level 15, State 1, Procedure _GetRandomTime, Line 14
    Incorrect syntax near the keyword 'CONVERT'.
    Msg 137, Level 15, State 2, Procedure _GetRandomTime, Line 19
    Must declare the scalar variable "@BasicDate".

    only first 3 queries worked
    check those querys again and edit it with ur correct db names
    and make sure u dont edited anything else

  8. #83
    Member anikan1985 is offline
    MemberRank
    Feb 2012 Join Date
    97Posts

    Re: [SQL] auto free Silk/Hour based on the Online time (System)

    Hey guys,

    can anyone explain me how i can change the time where the silks added to char ?
    it working well for me but the silks only added all 24h to the accounts. May someone
    can help me thanks

    best regards

    anikan1985

  9. #84
    Novice carmenjason is offline
    MemberRank
    Oct 2012 Join Date
    3Posts

    Re: [SQL] auto free Silk/Hour based on the Online time (System)

    I didn't change anything .. I'm using SQL Server 2005 btw!

  10. #85
    Apprentice neisser1 is offline
    MemberRank
    Apr 2012 Join Date
    19Posts

    Re: [SQL] auto free Silk/Hour based on the Online time (System)

    This query
    PHP Code:
    USE [SRO_VT_SHARDLOG]
    GO

    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO


    ALTER   procedure 
    [dbo].[_AddLogChar
    @
    CharID        int,
    @
    EventID        tinyint,
    @
    Data1        int,
    @
    Data2        int,
    @
    strPos        varchar(64),
    @
    Desc        varchar(128)
    as

    IF    ( -- 
    Skips over the unnecessary Records
            
    (@EventID != 11) AND 
            (@
    EventID NOT BETWEEN 21 AND 27) AND
            (@
    EventID NOT BETWEEN 200 AND 202) AND
            (@
    EventID NOT BETWEEN 204 AND 206) AND 
            (@
    EventID != 210) AND (@EventID != 214) AND (@EventID != 244)
        )
    BEGIN

        
    declare @len_pos     int
        
    declare @len_desc    int
        set 
    @len_pos len(@strPos)
        
    set @len_desc len(@Desc)
        if (@
    len_pos and @len_desc 0)
        
    begin    
            insert _LogEventChar values
    (@CharIDGetDate(), @EventID, @Data1, @Data2, @strPos, @Desc)    
        
    end
        
    else if (@len_pos and @len_desc 0)
        
    begin     
            insert _LogEventChar 
    (CharIDEventTimeEventIDData1Data2EventPosvalues(@CharIDGetDate(), @EventID, @Data1, @Data2, @strPos)
        
    end
        
    else if (@len_pos and @len_desc 0)
        
    begin     
            insert _LogEventChar 
    (CharIDEventTimeEventIDData1Data2strDescvalues(@CharIDGetDate(), @EventID, @Data1, @Data2, @Desc)
        
    end
        
    else
        
    begin
            insert _LogEventChar 
    (CharIDEventTimeEventIDData1Data2values(@CharIDGetDate(), @EventID, @Data1, @Data2)
        
    end
        
    /*Extension*/--> by Caipi

    IF not exists (SELECT CharID FROM _OnlineOffline WHERE CharID = @CharID)
        
    BEGIN
            INSERT INTO _OnlineOffline 
    (CharIDCharname, [Status], [Date], [Minutes], [tMinutes], eSilkmOnline, [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-ConfigWHERE [Desclike 'Rates'),
                    
    NULL
                    
    );
        
    END

    IF (@EventID OR @EventID 6)
        
    BEGIN

        
    IF (@EventID AND ((SELECT [StatusFROM _OnlineOffline WHERE CharID = @CharIDlike 'OnHold'))
            
    BEGIN
                UPDATE _OnlineOffline
                SET 
    [Status] = 'Offline'
                
    WHERE CharID = @CharID
            END
            
        
    IF (@EventID AND ((SELECT [StatusFROM _OnlineOffline WHERE CharID = @CharIDlike '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 [Statuslike 'Online'

    /*Silk/Hour basic calc*/
    IF ((SELECT [tMinutesfrom _OnlineOffline WHERE CharID = @CharID) >= (SELECT [Step1SilkFROM [_Silk/Hour-ConfigWHERE [Desclike '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&DateWHERE [Desclike 'Next'IS NULL))
        
    BEGIN
            
    DECLARE @FirstDate datetime, @Today datetime GETDATE(), @FirstCharID int;

            
    exec @FirstCharID SRO_VT_SHARD.dbo._RandomPlayerID
            exec SRO_VT_SHARD
    .dbo._GetRandomTime @Today, @FirstDate OUTPUT
            
            UPDATE 
    [_RandomPlayer&Date
                
    SET 
                    NextDate 
    = @FirstDate,
                    
    RefreshedDate GETDATE(),
                    
    CharID = @FirstCharID,
                    
    Charname = (SELECT CharName16 FROM SRO_VT_SHARD.dbo._Char WHERE CharID = @FirstCharID)
                
    WHERE [Desclike 'Next';
        
    END
        
    IF ((SELECT NextDate FROM [_RandomPlayer&DateWHERE [Desclike 'Next') <= GETDATE())
        
    BEGIN
            UPDATE _OnlineOffline
                SET 
    [Silk/Hour] = (SELECT RewardSilk FROM [_Silk/Hour-ConfigWHERE [Desclike 'Rates')
                
    WHERE CharID = (SELECT CharID FROM [_RandomPlayer&DateWHERE [Desclike 'Next');
            Declare
                    @
    CurSilkperHour int
                    @
    OldCharID int = (SELECT CharID FROM [_RandomPlayer&DateWHERE [Desclike '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&DateWHERE [Desclike 'Next'),
                    
    Charname = (SELECT Charname FROM [_RandomPlayer&DateWHERE [Desclike 'Next')
                
    WHERE [Desclike 'Current'
            
            
    /*new Random Time of Today+1*/
            
    DECLARE @NextDate datetime, @Tomorrow datetime GETDATE()+1, @NewCharID int;
            
            
    exec @NewCharID SRO_VT_SHARD.dbo._RandomPlayerID
            exec SRO_VT_SHARD
    .dbo._GetRandomTime @Tomorrow, @NextDate OUTPUT
            
            UPDATE 
    [_RandomPlayer&Date
                
    SET 
                    NextDate 
    = @NextDate,
                    
    RefreshedDate GETDATE(),
                    
    CharID = @NewCharID,
                    
    Charname = (SELECT CharName16 FROM SRO_VT_SHARD.dbo._Char WHERE CharID = @NewCharID)
                
    WHERE [Desclike 'Next'
            
    /*!new Random...*/
        
    END
        
        
    /*Calculation of the silk amount*/
        
    Declare @tMinutes bigint = (SELECT [Minutesfrom _OnlineOffline WHERE CharID = @CharID), @Silk int;
        
            IF (@
    tMinutes >= 60)
                
    BEGIN
                    SET 
    @Silk CAST(((SELECT [MinutesFROM _OnlineOffline WHERE CharID = @CharID) / 60) as int)
                    
    UPDATE _OnlineOffline
                    SET 
    [Minutes] = [Minutes] % 60
                    WHERE CharID 
    = @CharID
                    
                
    IF exists (SELECT [WEEKDAYSFROM [_Silk/Hour-ConfigWHERE [WEEKDAYSlike DATENAME(WEEKDAYGETDATE()))
                    
    BEGIN
                        UPDATE _OnlineOffline
                        SET 
    [eSilk] = [eSilk] + (@Silk*[Silk/Hour])
                        
    WHERE CharID = @CharID
                        
                        exec SRO_VT_ACCOUNT
    .dbo._extraSilk @CharID, @Silk
                    END
                END
        
    /*!Calc*/
        
    /*!Extension*/

    END -- !Skipping 
    This Error
    PHP Code:
    Mens 208Nivel 16Estado 6Procedimiento _AddLogCharLínea 179
    Invalid object name 
    'dbo._AddLogChar'
    help please :S

  11. #86
    Apprentice meowlicious is offline
    MemberRank
    Sep 2011 Join Date
    16Posts

    Re: [SQL] auto free Silk/Hour based on the Online time (System)

    well you forgot to execute this part i guess


    PHP Code:
    USE [SRO_VT_SHARDLOG]
    GO

    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO


    ALTER   procedure 
    [dbo].[_AddLogChar
    @
    CharID        int,
    @
    EventID        tinyint,
    @
    Data1        int,
    @
    Data2        int,
    @
    strPos        varchar(64),
    @
    Desc        varchar(128)
    as

    IF    ( -- 
    Skips over the unnecessary Records
            
    (@EventID != 11) AND 
            (@
    EventID NOT BETWEEN 21 AND 27) AND
            (@
    EventID NOT BETWEEN 200 AND 202) AND
            (@
    EventID NOT BETWEEN 204 AND 206) AND 
            (@
    EventID != 210) AND (@EventID != 214) AND (@EventID != 244)
        )
    BEGIN

        
    declare @len_pos     int
        
    declare @len_desc    int
        set 
    @len_pos len(@strPos)
        
    set @len_desc len(@Desc)
        if (@
    len_pos and @len_desc 0)
        
    begin    
            insert _LogEventChar values
    (@CharIDGetDate(), @EventID, @Data1, @Data2, @strPos, @Desc)    
        
    end
        
    else if (@len_pos and @len_desc 0)
        
    begin     
            insert _LogEventChar 
    (CharIDEventTimeEventIDData1Data2EventPosvalues(@CharIDGetDate(), @EventID, @Data1, @Data2, @strPos)
        
    end
        
    else if (@len_pos and @len_desc 0)
        
    begin     
            insert _LogEventChar 
    (CharIDEventTimeEventIDData1Data2strDescvalues(@CharIDGetDate(), @EventID, @Data1, @Data2, @Desc)
        
    end
        
    else
        
    begin
            insert _LogEventChar 
    (CharIDEventTimeEventIDData1Data2values(@CharIDGetDate(), @EventID, @Data1, @Data2)
        
    end
        
    /*Extension*/--> by Caipi

    IF not exists (SELECT CharID FROM _OnlineOffline WHERE CharID = @CharID)
        
    BEGIN
            INSERT INTO _OnlineOffline 
    (CharIDCharname, [Status], [Date], [Minutes], [tMinutes], eSilkmOnline, [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-ConfigWHERE [Desclike 'Rates'),
                    
    NULL
                    
    );
        
    END

    IF (@EventID OR @EventID 6)
        
    BEGIN

        
    IF (@EventID AND ((SELECT [StatusFROM _OnlineOffline WHERE CharID = @CharIDlike 'OnHold'))
            
    BEGIN
                UPDATE _OnlineOffline
                SET 
    [Status] = 'Offline'
                
    WHERE CharID = @CharID
            END
            
        
    IF (@EventID AND ((SELECT [StatusFROM _OnlineOffline WHERE CharID = @CharIDlike '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 [Statuslike 'Online'

    /*Silk/Hour basic calc*/
    IF ((SELECT [tMinutesfrom _OnlineOffline WHERE CharID = @CharID) >= (SELECT [Step1SilkFROM [_Silk/Hour-ConfigWHERE [Desclike '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&DateWHERE [Desclike 'Next'IS NULL))
        
    BEGIN
            
    DECLARE @FirstDate datetime, @Today datetime GETDATE(), @FirstCharID int;

            
    exec @FirstCharID SRO_VT_SHARD.dbo._RandomPlayerID
            exec SRO_VT_SHARD
    .dbo._GetRandomTime @Today, @FirstDate OUTPUT
            
            UPDATE 
    [_RandomPlayer&Date
                
    SET 
                    NextDate 
    = @FirstDate,
                    
    RefreshedDate GETDATE(),
                    
    CharID = @FirstCharID,
                    
    Charname = (SELECT CharName16 FROM SRO_VT_SHARD.dbo._Char WHERE CharID = @FirstCharID)
                
    WHERE [Desclike 'Next';
        
    END
        
    IF ((SELECT NextDate FROM [_RandomPlayer&DateWHERE [Desclike 'Next') <= GETDATE())
        
    BEGIN
            UPDATE _OnlineOffline
                SET 
    [Silk/Hour] = (SELECT RewardSilk FROM [_Silk/Hour-ConfigWHERE [Desclike 'Rates')
                
    WHERE CharID = (SELECT CharID FROM [_RandomPlayer&DateWHERE [Desclike 'Next');
            Declare
                    @
    CurSilkperHour int
                    @
    OldCharID int = (SELECT CharID FROM [_RandomPlayer&DateWHERE [Desclike '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&DateWHERE [Desclike 'Next'),
                    
    Charname = (SELECT Charname FROM [_RandomPlayer&DateWHERE [Desclike 'Next')
                
    WHERE [Desclike 'Current'
            
            
    /*new Random Time of Today+1*/
            
    DECLARE @NextDate datetime, @Tomorrow datetime GETDATE()+1, @NewCharID int;
            
            
    exec @NewCharID SRO_VT_SHARD.dbo._RandomPlayerID
            exec SRO_VT_SHARD
    .dbo._GetRandomTime @Tomorrow, @NextDate OUTPUT
            
            UPDATE 
    [_RandomPlayer&Date
                
    SET 
                    NextDate 
    = @NextDate,
                    
    RefreshedDate GETDATE(),
                    
    CharID = @NewCharID,
                    
    Charname = (SELECT CharName16 FROM SRO_VT_SHARD.dbo._Char WHERE CharID = @NewCharID)
                
    WHERE [Desclike 'Next'
            
    /*!new Random...*/
        
    END
        
        
    /*Calculation of the silk amount*/
        
    Declare @tMinutes bigint = (SELECT [Minutesfrom _OnlineOffline WHERE CharID = @CharID), @Silk int;
        
            IF (@
    tMinutes >= 60)
                
    BEGIN
                    SET 
    @Silk CAST(((SELECT [MinutesFROM _OnlineOffline WHERE CharID = @CharID) / 60) as int)
                    
    UPDATE _OnlineOffline
                    SET 
    [Minutes] = [Minutes] % 60
                    WHERE CharID 
    = @CharID
                    
                
    IF exists (SELECT [WEEKDAYSFROM [_Silk/Hour-ConfigWHERE [WEEKDAYSlike DATENAME(WEEKDAYGETDATE()))
                    
    BEGIN
                        UPDATE _OnlineOffline
                        SET 
    [eSilk] = [eSilk] + (@Silk*[Silk/Hour])
                        
    WHERE CharID = @CharID
                        
                        exec SRO_VT_ACCOUNT
    .dbo._extraSilk @CharID, @Silk
                    END
                END
        
    /*!Calc*/
        
    /*!Extension*/

    END -- !Skipping 

  12. #87
    Apprentice neisser1 is offline
    MemberRank
    Apr 2012 Join Date
    19Posts

    Re: [SQL] auto free Silk/Hour based on the Online time (System)

    Quote Originally Posted by meowlicious View Post
    well you forgot to execute this part i guess


    PHP Code:
    USE [SRO_VT_SHARDLOG]
    GO

    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO


    ALTER   procedure 
    [dbo].[_AddLogChar
    @
    CharID        int,
    @
    EventID        tinyint,
    @
    Data1        int,
    @
    Data2        int,
    @
    strPos        varchar(64),
    @
    Desc        varchar(128)
    as

    IF    ( -- 
    Skips over the unnecessary Records
            
    (@EventID != 11) AND 
            (@
    EventID NOT BETWEEN 21 AND 27) AND
            (@
    EventID NOT BETWEEN 200 AND 202) AND
            (@
    EventID NOT BETWEEN 204 AND 206) AND 
            (@
    EventID != 210) AND (@EventID != 214) AND (@EventID != 244)
        )
    BEGIN

        
    declare @len_pos     int
        
    declare @len_desc    int
        set 
    @len_pos len(@strPos)
        
    set @len_desc len(@Desc)
        if (@
    len_pos and @len_desc 0)
        
    begin    
            insert _LogEventChar values
    (@CharIDGetDate(), @EventID, @Data1, @Data2, @strPos, @Desc)    
        
    end
        
    else if (@len_pos and @len_desc 0)
        
    begin     
            insert _LogEventChar 
    (CharIDEventTimeEventIDData1Data2EventPosvalues(@CharIDGetDate(), @EventID, @Data1, @Data2, @strPos)
        
    end
        
    else if (@len_pos and @len_desc 0)
        
    begin     
            insert _LogEventChar 
    (CharIDEventTimeEventIDData1Data2strDescvalues(@CharIDGetDate(), @EventID, @Data1, @Data2, @Desc)
        
    end
        
    else
        
    begin
            insert _LogEventChar 
    (CharIDEventTimeEventIDData1Data2values(@CharIDGetDate(), @EventID, @Data1, @Data2)
        
    end
        
    /*Extension*/--> by Caipi

    IF not exists (SELECT CharID FROM _OnlineOffline WHERE CharID = @CharID)
        
    BEGIN
            INSERT INTO _OnlineOffline 
    (CharIDCharname, [Status], [Date], [Minutes], [tMinutes], eSilkmOnline, [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-ConfigWHERE [Desclike 'Rates'),
                    
    NULL
                    
    );
        
    END

    IF (@EventID OR @EventID 6)
        
    BEGIN

        
    IF (@EventID AND ((SELECT [StatusFROM _OnlineOffline WHERE CharID = @CharIDlike 'OnHold'))
            
    BEGIN
                UPDATE _OnlineOffline
                SET 
    [Status] = 'Offline'
                
    WHERE CharID = @CharID
            END
            
        
    IF (@EventID AND ((SELECT [StatusFROM _OnlineOffline WHERE CharID = @CharIDlike '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 [Statuslike 'Online'

    /*Silk/Hour basic calc*/
    IF ((SELECT [tMinutesfrom _OnlineOffline WHERE CharID = @CharID) >= (SELECT [Step1SilkFROM [_Silk/Hour-ConfigWHERE [Desclike '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&DateWHERE [Desclike 'Next'IS NULL))
        
    BEGIN
            
    DECLARE @FirstDate datetime, @Today datetime GETDATE(), @FirstCharID int;

            
    exec @FirstCharID SRO_VT_SHARD.dbo._RandomPlayerID
            exec SRO_VT_SHARD
    .dbo._GetRandomTime @Today, @FirstDate OUTPUT
            
            UPDATE 
    [_RandomPlayer&Date
                
    SET 
                    NextDate 
    = @FirstDate,
                    
    RefreshedDate GETDATE(),
                    
    CharID = @FirstCharID,
                    
    Charname = (SELECT CharName16 FROM SRO_VT_SHARD.dbo._Char WHERE CharID = @FirstCharID)
                
    WHERE [Desclike 'Next';
        
    END
        
    IF ((SELECT NextDate FROM [_RandomPlayer&DateWHERE [Desclike 'Next') <= GETDATE())
        
    BEGIN
            UPDATE _OnlineOffline
                SET 
    [Silk/Hour] = (SELECT RewardSilk FROM [_Silk/Hour-ConfigWHERE [Desclike 'Rates')
                
    WHERE CharID = (SELECT CharID FROM [_RandomPlayer&DateWHERE [Desclike 'Next');
            Declare
                    @
    CurSilkperHour int
                    @
    OldCharID int = (SELECT CharID FROM [_RandomPlayer&DateWHERE [Desclike '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&DateWHERE [Desclike 'Next'),
                    
    Charname = (SELECT Charname FROM [_RandomPlayer&DateWHERE [Desclike 'Next')
                
    WHERE [Desclike 'Current'
            
            
    /*new Random Time of Today+1*/
            
    DECLARE @NextDate datetime, @Tomorrow datetime GETDATE()+1, @NewCharID int;
            
            
    exec @NewCharID SRO_VT_SHARD.dbo._RandomPlayerID
            exec SRO_VT_SHARD
    .dbo._GetRandomTime @Tomorrow, @NextDate OUTPUT
            
            UPDATE 
    [_RandomPlayer&Date
                
    SET 
                    NextDate 
    = @NextDate,
                    
    RefreshedDate GETDATE(),
                    
    CharID = @NewCharID,
                    
    Charname = (SELECT CharName16 FROM SRO_VT_SHARD.dbo._Char WHERE CharID = @NewCharID)
                
    WHERE [Desclike 'Next'
            
    /*!new Random...*/
        
    END
        
        
    /*Calculation of the silk amount*/
        
    Declare @tMinutes bigint = (SELECT [Minutesfrom _OnlineOffline WHERE CharID = @CharID), @Silk int;
        
            IF (@
    tMinutes >= 60)
                
    BEGIN
                    SET 
    @Silk CAST(((SELECT [MinutesFROM _OnlineOffline WHERE CharID = @CharID) / 60) as int)
                    
    UPDATE _OnlineOffline
                    SET 
    [Minutes] = [Minutes] % 60
                    WHERE CharID 
    = @CharID
                    
                
    IF exists (SELECT [WEEKDAYSFROM [_Silk/Hour-ConfigWHERE [WEEKDAYSlike DATENAME(WEEKDAYGETDATE()))
                    
    BEGIN
                        UPDATE _OnlineOffline
                        SET 
    [eSilk] = [eSilk] + (@Silk*[Silk/Hour])
                        
    WHERE CharID = @CharID
                        
                        exec SRO_VT_ACCOUNT
    .dbo._extraSilk @CharID, @Silk
                    END
                END
        
    /*!Calc*/
        
    /*!Extension*/

    END -- !Skipping 
    I run but I get the error
    PHP Code:
    Mens 208Nivel 16Estado 6Procedimiento _AddLogCharLínea 179
    Invalid object name 
    'dbo._AddLogChar'

  13. #88
    #Yummi.sql Caipi is offline
    MemberRank
    Sep 2011 Join Date
    GermanyLocation
    403Posts

    Re: [SQL] auto free Silk/Hour based on the Online time (System)

    SHARDLOG = LOG DB ^^ Either you tried to execute it on the wrong database or you lack of an _AddLogChar-Procedure in your LOG DB, which would be quite uncommon

  14. #89
    Apprentice neisser1 is offline
    MemberRank
    Apr 2012 Join Date
    19Posts

    Re: [SQL] auto free Silk/Hour based on the Online time (System)

    I change the SHARD LOG for LOG DB, and that error comes, I think it's because there AddLogChar, as you would?
    Thanks you
    Last edited by neisser1; 15-11-12 at 10:45 PM.

  15. #90
    Apprentice neisser1 is offline
    MemberRank
    Apr 2012 Join Date
    19Posts

    Re: [SQL] auto free Silk/Hour based on the Online time (System)

    Help please :S



Advertisement