Ecoin on DG

Page 2 of 2 FirstFirst 12
Results 16 to 25 of 25
  1. #16
    Ultimate Member Tryout is offline
    MemberRank
    Jul 2020 Join Date
    153Posts

    Re: Ecoin on DG

    Ecoin on DG
    Quote Originally Posted by ronsamrn View Post
    Other method would be creating a table for Dungeon with corresponding ecoin reward and use select statement. its easier to update table values when you decided to change ecoin rewards for each dungeon.
    DECLARE @ecoin int

    SELECT @ecoin = ecoin
    FROM cabal_DungeonEcoin_Table
    WHERE DungeonIdx = 194<<< is correct?

    SET @CNT = 1
    WHILE @CNT < DATALENGTH ( @memberData )
    BEGIN
    SET @memId = dbo.BinToInt(SUBSTRING ( @memberData,@CNT,4 ))
    UPDATE CabalCash.dbo.CashAccount set Cash = Cash + @ecoin where UserNum = @memId/8
    SET @CNT= @CNT+27
    END

  2. #17
    Registered ronsamrn is offline
    MemberRank
    Sep 2020 Join Date
    /etcLocation
    18Posts

    Re: Ecoin on DG

    Quote Originally Posted by Tryout View Post
    DECLARE @ecoin int

    SELECT @ecoin = ecoin
    FROM cabal_DungeonEcoin_Table
    WHERE DungeonIdx = 194<<< is correct?

    SET @CNT = 1
    WHILE @CNT < DATALENGTH ( @memberData )
    BEGIN
    SET @memId = dbo.BinToInt(SUBSTRING ( @memberData,@CNT,4 ))
    UPDATE CabalCash.dbo.CashAccount set Cash = Cash + @ecoin where UserNum = @memId/8
    SET @CNT= @CNT+27
    END
    Create a new table with dungeonid and ecoin value for that code to work.

    Code:
    USE [Server01]
    GO
    
    /****** Object:  Table [dbo].[cabal_DungeonEcoin_Table]    Script Date: 10/11/2020 8:13:22 PM ******/
    SET ANSI_NULLS ON
    GO
    
    SET QUOTED_IDENTIFIER ON
    GO
    
    CREATE TABLE [dbo].[cabal_DungeonEcoin_Table](
        [DungeonIdx] [int] NOT NULL,
        [ecoin] [int] NOT NULL,
     CONSTRAINT [PK_cabal_DungeonEcoin_Table] PRIMARY KEY CLUSTERED 
    (
        [DungeonIdx] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    sample table content
    DungeonIdx ecoin
    293
    50
    4353
    150
    293 is for Volcanic Citadel
    4353 id for Ancient Tomb

    I hope you get the idea.

  3. #18
    Ultimate Member Tryout is offline
    MemberRank
    Jul 2020 Join Date
    153Posts

    Re: Ecoin on DG

    Quote Originally Posted by ronsamrn View Post
    Create a new table with dungeonid and ecoin value for that code to work.

    Code:
    USE [Server01]
    GO
    
    /****** Object:  Table [dbo].[cabal_DungeonEcoin_Table]    Script Date: 10/11/2020 8:13:22 PM ******/
    SET ANSI_NULLS ON
    GO
    
    SET QUOTED_IDENTIFIER ON
    GO
    
    CREATE TABLE [dbo].[cabal_DungeonEcoin_Table](
        [DungeonIdx] [int] NOT NULL,
        [ecoin] [int] NOT NULL,
     CONSTRAINT [PK_cabal_DungeonEcoin_Table] PRIMARY KEY CLUSTERED 
    (
        [DungeonIdx] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    sample table content
    DungeonIdx ecoin
    293
    50
    4353
    150
    293 is for Volcanic Citadel
    4353 id for Ancient Tomb

    I hope you get the idea.
    I get it, thanks. Is this working both Party and Solo DG?

  4. #19
    Registered ronsamrn is offline
    MemberRank
    Sep 2020 Join Date
    /etcLocation
    18Posts

    Re: Ecoin on DG

    I get it, thanks. Is this working both Party and Solo DG?
    yes. just add select query after variable declaration.

  5. #20
    Ultimate Member Tryout is offline
    MemberRank
    Jul 2020 Join Date
    153Posts

    Re: Ecoin on DG

    I got this error after executing first query, I'm using sql2008 r2

    Msg 155, Level 15, State 1, Line 8'OPTIMIZE_FOR_SEQUENTIAL_KEY' is not a recognized CREATE TABLE option.

  6. #21
    Registered ronsamrn is offline
    MemberRank
    Sep 2020 Join Date
    /etcLocation
    18Posts

    Re: Ecoin on DG

    try this

    Code:
    USE [Server01]
    GO
    
    /****** Object:  Table [dbo].[cabal_DungeonEcoin_Table]    Script Date: 10/28/2020 11:54:22 AM ******/
    SET ANSI_NULLS ON
    GO
    
    SET QUOTED_IDENTIFIER ON
    GO
    
    CREATE TABLE [dbo].[cabal_DungeonEcoin_Table](
    	[DungeonIdx] [int] NOT NULL,
    	[ecoin] [int] NOT NULL
    ) ON [PRIMARY]
    GO

  7. #22
    Ultimate Member Tryout is offline
    MemberRank
    Jul 2020 Join Date
    153Posts

    Re: Ecoin on DG

    Now 2nd script has also error

    Code:
    Msg 137, Level 15, State 2, Line 5Must declare the scalar variable "@dungeonIdx".
    Msg 137, Level 15, State 1, Line 7Must declare the scalar variable "@CNT".
    Msg 137, Level 15, State 2, Line 8Must declare the scalar variable "@CNT".
    Msg 137, Level 15, State 2, Line 10Must declare the scalar variable "@memberData".
    Msg 137, Level 15, State 2, Line 11Must declare the scalar variable "@memId".
    Msg 137, Level 15, State 2, Line 12Must declare the scalar variable "@CNT".

  8. #23
    Registered ronsamrn is offline
    MemberRank
    Sep 2020 Join Date
    /etcLocation
    18Posts

    Re: Ecoin on DG

    cabal_sp_DungeonRanking_Party_Clear_Set

    Code:
    USE [Server01]
    GO
    /****** Object:  StoredProcedure [dbo].[cabal_sp_DungeonRanking_Party_Clear_Set]    Script Date: 10/11/2020 8:14:53 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE [dbo].[cabal_sp_DungeonRanking_Party_Clear_Set] @dungeonIdx int, @ClearTimeSec int
                                                    , @LeaderCharIdx int, @LeaderName [varchar](20)
                                                    , @Levelsum int, @memberData [varbinary](300))
    AS
    BEGIN
        SET NOCOUNT ON
        DECLARE @SavedClearTimeSec int
        DECLARE @count int
        DECLARE @ecoin int    
        DECLARE @CNT int, @memId int
        
        SELECT @ecoin = ecoin
        FROM cabal_DungeonEcoin_Table
        WHERE DungeonIdx = @dungeonIdx
            
        SET @CNT = 1
        WHILE @CNT < DATALENGTH ( @memberData )
            BEGIN
                SET @memId = dbo.BinToInt(SUBSTRING ( @memberData,@CNT,4 ))
                UPDATE CabalCash.dbo.CashAccount set Cash = Cash + @ecoin where UserNum = @memId/8
                SET @CNT= @CNT+27
            END
    
        SELECT TOP 20 @SavedClearTimeSec = [ClearTimeSec]
        FROM [cabal_DungeonRankingParty_table]
        WHERE DungeonIdx = @dungeonIdx
        ORDER BY [ClearTimeSec]
        
        SET @count = @@rowCount
        
        IF(@SavedClearTimeSec < @ClearTimeSec and @count >= 20)
        BEGIN
            RETURN
        END
    
        INSERT [cabal_DungeonRankingParty_table] ([DungeonIdx], [ClearTimeSec], [LeaderCharIdx]
                    , [LeaderName], [LevelSum], [PartyMemberData], [CurrentRank], [LastRank], [ClearDate])
        VALUES @dungeonIdx, @ClearTimeSec, @LeaderCharIdx, @LeaderName, @Levelsum, @memberData, 0, 0, GetDate())
    
        IF @count >= 20)
        BEGIN
            DELETE [cabal_DungeonRankingParty_table]
            WHERE DungeonIdx = @dungeonIdx AND [ClearTimeSec] = @SavedClearTimeSec
        END
    END
    cabal_sp_DungeonRanking_Single_Clear_Set

    Code:
    USE [Server01]
    GO
    /****** Object:  StoredProcedure [dbo].[cabal_sp_DungeonRanking_Single_Clear_Set]    Script Date: 10/28/2020 1:18:19 PM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROCEDURE [dbo].[cabal_sp_DungeonRanking_Single_Clear_Set] @dungeonIdx int, @ClearTimeSec int, @CharIdx int
    														, @name [varchar](20), @level int, @BattleStyle int)
    AS
    BEGIN
    	SET NOCOUNT ON
    	DECLARE @SavedClearTimeSec int
    	DECLARE @count int
    	DECLARE @ecoin int		
    	
    	SELECT @ecoin = ecoin
    	FROM cabal_DungeonEcoin_Table
    	WHERE DungeonIdx = @dungeonIdx 
    		
    	UPDATE CabalCash.dbo.CashAccount set Cash = Cash + @ecoin where UserNum = @Charidx/8
    
    	SELECT @SavedClearTimeSec = [ClearTimeSec]
    	FROM [cabal_DungeonRankingSingle_table]
    	WHERE DungeonIdx = @dungeonIdx AND [CharIdx] = @CharIdx
    	
    	IF(@@rowcount <> 0)
    	BEGIN
    		IF @ClearTimeSec < @SavedClearTimeSec)
    		BEGIN
    			UPDATE [cabal_DungeonRankingSingle_table] 
    			SET [ClearTimeSec] = @ClearTimeSec, [Level] = @level, Name = @name, ClearDate = Getdate()
    			WHERE DungeonIdx = @dungeonIdx AND [CharIdx] = @CharIdx
    		END
    		
    		RETURN
    	END
    	
    	SELECT TOP 200 @SavedClearTimeSec = [ClearTimeSec]
    	FROM [cabal_DungeonRankingSingle_table]
    	WHERE DungeonIdx = @dungeonIdx
    	ORDER BY [ClearTimeSec]
    	
    	SET @count = @@rowCount
    	
    	IF(@SavedClearTimeSec < @ClearTimeSec and @count >= 200)
    	BEGIN
    		RETURN
    	END
    
    	INSERT [cabal_DungeonRankingSingle_table]
    		([DungeonIdx], [ClearTimeSec], [CharIdx], [Name], [Level],
    		 [BattleStyle], [CurrentRank], [LastRank], [ClearDate])
    	VALUES @dungeonIdx, @ClearTimeSec, @CharIdx, @name, @level,
    	 @BattleStyle, 0, 0, GetDate())
    
    	IF @count >= 200)
    	BEGIN
    		DELETE [cabal_DungeonRankingSingle_table]
    		WHERE DungeonIdx = @dungeonIdx AND [ClearTimeSec] = @SavedClearTimeSec
    	END
    END

  9. #24
    Ultimate Member Tryout is offline
    MemberRank
    Jul 2020 Join Date
    153Posts

    Re: Ecoin on DG

    Do I need to run the Declare query on the 1st page, 2nd query?

    - - - Updated - - -

    Tried to finish DG but it doesn't give me ecoin as reward.

  10. #25
    Member upanddown is offline
    MemberRank
    Jul 2020 Join Date
    33Posts

    Re: Ecoin on DG

    Try editing eventsave_singledungeon and _partydungeon but it will be dungeon name instead of IDX



Page 2 of 2 FirstFirst 12

Advertisement