[FIX] [_RegisterAutomatedPunishment]

Newbie Spellweaver
Joined
Oct 31, 2011
Messages
66
Reaction score
11
Hello,

here is my fix for the RegisterAutomatedPunishment procedure.

What will it fix?
Prevents that players can unblock themselve when they type in the password 3 times incorrect.


Procedure:
Code:
USE [SRO_VT_ACCOUNT]
GO
/****** Object:  StoredProcedure [dbo].[_RegisterAutomatedPunishment]    Script Date: 03/23/2012 00:10:37 ******/
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER OFF
GO

ALTER PROCEDURE [dbo].[_RegisterAutomatedPunishment]
    @Account    VARCHAR(128),    --This is "strUserID"
    @Type          TINYINT,
    @Executor    VARCHAR(128),
    @Guide        VARCHAR(512),
    @Description    VARCHAR(1024),
    @BlockTimeElapse    INT
AS
    ------------------------------------------------------------------------------------
    -- novice with deepdark
    -- depend only on db time.. we dont have to sync the time between DB and GlobalManager for accuracy
    DECLARE @BlockStartTime    VARCHAR(128)
    DECLARE @BlockEndTime    VARCHAR(128)

    SET @BlockStartTime     = getdate()
    SET @BlockEndTime    = dateadd( mi, @BlockTimeElapse, @BlockStartTime)
    ------------------------------------------------------------------------------------

    DECLARE @UserJID INT
    SET @UserJID = 0

    -- Get UserJID from provided @Account.
    SELECT @UserJID = JID FROM TB_User WITH (NOLOCK) WHERE strUserID = @Account
    IF @@ERROR <> 0 OR @UserJID = 0
    BEGIN
        SELECT -1
        RETURN
    END
    
    DECLARE    @return_value int
    -- Check if user is blocked before and execute proper SP.  ---- Query fixed by Wismo
    IF( EXISTS ( SELECT UserJID FROM _BlockedUser WITH (NOLOCK) WHERE UserJID = @UserJID AND Type = @Type and timeEnd < getdate()))
    BEGIN
        DECLARE @SerialNo INT
        SET @SerialNo = 0
        SELECT @SerialNo = SerialNo FROM _Punishment WITH (NOLOCK) WHERE UserJID = @UserJID
        EXEC    @return_value = [dbo].[_UpdatePunishment] @SerialNo, @UserJID, @Type, @Executor,0, '', '', '', @Guide, @Description, @BlockStartTime, @BlockStartTime, @BlockEndTime, @BlockStartTime
    END
    
    ELSE 
    BEGIN
        EXEC    @return_value = [dbo].[_RegisterPunishment] @UserJID, @Type, @Executor,0, '', '', '', @Guide, @Description, @BlockStartTime, @BlockStartTime, @BlockEndTime, @BlockStartTime
    END


    SELECT @UserJID

Thank you,
Wismo ( )
 
Back