Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Ecoin on DG

RaGEZONE VIP
[VIP] Member
Joined
Oct 10, 2019
Messages
198
Reaction score
455
For cabal_sp_DungeonRanking_Single_Clear_Set
Code:
Update CabalCash.dbo.CashAccount set Cash = Cash + ? where UserNum = @[I][B][URL="http://forum.ragezone.com/members/551894.html"]Char[/URL][/B][/I]Idx/8

There will be something like this for the party:
cabal_sp_DungeonRanking_Party_Clear_Set

Code:
        DECLARE @CNT int, @[I][B][URL="http://forum.ragezone.com/members/2000256504.html"]mem[/URL][/B][/I]Id int
        SET @CNT = 1

        WHILE @CNT < DATALENGTH ( @[I][B][URL="http://forum.ragezone.com/members/2000256504.html"]mem[/URL][/B][/I]berData )
        BEGIN
                SET @[I][B][URL="http://forum.ragezone.com/members/2000256504.html"]mem[/URL][/B][/I]Id = dbo.BinToInt(SUBSTRING ( @[I][B][URL="http://forum.ragezone.com/members/2000256504.html"]mem[/URL][/B][/I]berData,@CNT,4 ))
                Update CabalCash.dbo.CashAccount set Cash = Cash + ? where UserNum = @[I][B][URL="http://forum.ragezone.com/members/2000256504.html"]mem[/URL][/B][/I]Id/8
                SET @CNT= @CNT+27
        END
 
Last edited:
Upvote 0
Banned
Banned
Joined
Jul 14, 2020
Messages
420
Reaction score
35
For cabal_sp_DungeonRanking_Single_Clear_Set
Code:
Update CabalCash.dbo.CashAccount set Cash = Cash + ? where UserNum = @[I][B][URL="http://forum.ragezone.com/members/551894.html"]Char[/URL][/B][/I]Idx/8

There will be something like this for the party:
cabal_sp_DungeonRanking_Party_Clear_Set

Code:
        DECLARE @CNT int, @[I][B][URL="http://forum.ragezone.com/members/2000256504.html"]mem[/URL][/B][/I]Id int
        SET @CNT = 1

        WHILE @CNT < DATALENGTH ( @[I][B][URL="http://forum.ragezone.com/members/2000256504.html"]mem[/URL][/B][/I]berData )
        BEGIN
                SET @[I][B][URL="http://forum.ragezone.com/members/2000256504.html"]mem[/URL][/B][/I]Id = dbo.BinToInt(SUBSTRING ( @[I][B][URL="http://forum.ragezone.com/members/2000256504.html"]mem[/URL][/B][/I]berData,@CNT,4 ))
                Update CabalCash.dbo.CashAccount set Cash = Cash + ? where UserNum = @[I][B][URL="http://forum.ragezone.com/members/2000256504.html"]mem[/URL][/B][/I]Id/8
                SET @CNT= @CNT+27
        END
How about query for the party with specific dungeon (If I only want to do it with one dungeon)?



Is this correct?

Code:
DECLARE @CNT int, [USER=2000256504]mem[/USER]Id int
        SET @CNT = 1

        WHILE @CNT < DATALENGTH ( [USER=2000256504]mem[/USER]berData )
        IF (@DungeonIdx = ?)
BEGIN
             SET [USER=2000256504]mem[/USER]Id = dbo.BinToInt(SUBSTRING ( [USER=2000256504]mem[/USER]berData,@CNT,4 ))
             Update CabalCash.dbo.CashAccount set Cash = Cash + ? where UserNum = [USER=2000256504]mem[/USER]Id/8
             SET @CNT= @CNT+27
        END
 
Upvote 0
RaGEZONE VIP
[VIP] Member
Joined
Oct 10, 2019
Messages
198
Reaction score
455
How about query for the party with specific dungeon (If I only want to do it with one dungeon)?



Is this correct?

Code:
DECLARE @CNT int, @[I][B][URL="http://forum.ragezone.com/members/2000256504.html"]mem[/URL][/B][/I]Id int
        SET @CNT = 1

        WHILE @CNT < DATALENGTH ( @[I][B][URL="http://forum.ragezone.com/members/2000256504.html"]mem[/URL][/B][/I]berData )
        IF  @[I][B][URL="http://forum.ragezone.com/members/2000255614.html"]dung[/URL][/B][/I]eonIdx = ?)
BEGIN
             SET @[I][B][URL="http://forum.ragezone.com/members/2000256504.html"]mem[/URL][/B][/I]Id = dbo.BinToInt(SUBSTRING ( @[I][B][URL="http://forum.ragezone.com/members/2000256504.html"]mem[/URL][/B][/I]berData,@CNT,4 ))
             Update CabalCash.dbo.CashAccount set Cash = Cash + ? where UserNum = @[I][B][URL="http://forum.ragezone.com/members/2000256504.html"]mem[/URL][/B][/I]Id/8
             SET @CNT= @CNT+27
        END
Code:
DECLARE @CNT int, @[I][B][URL="http://forum.ragezone.com/members/2000256504.html"]mem[/URL][/B][/I]Id int, @reward int
SET @reward = 
    CASE
        WHEN @[I][B][URL="http://forum.ragezone.com/members/2000255614.html"]dung[/URL][/B][/I]eonIdx = 4252 THEN 100 --100 eCoins for DungeonIdx=4252
        WHEN @[I][B][URL="http://forum.ragezone.com/members/2000255614.html"]dung[/URL][/B][/I]eonIdx = 4253 THEN 200 --200 eCoins for DungeonIdx=4253
        WHEN @[I][B][URL="http://forum.ragezone.com/members/2000255614.html"]dung[/URL][/B][/I]eonIdx = 4254 THEN 300 --300 eCoins for DungeonIdx=4254
        ELSE 0 --Default - 0 eCoins
    END
IF (@reward>0)
BEGIN
    SET @CNT = 1
    WHILE @CNT < DATALENGTH ( @[I][B][URL="http://forum.ragezone.com/members/2000256504.html"]mem[/URL][/B][/I]berData )
    BEGIN
        SET @[I][B][URL="http://forum.ragezone.com/members/2000256504.html"]mem[/URL][/B][/I]Id = dbo.BinToInt(SUBSTRING ( @[I][B][URL="http://forum.ragezone.com/members/2000256504.html"]mem[/URL][/B][/I]berData,@CNT,4 ))
        Update CabalCash.dbo.CashAccount set Cash = Cash + @reward where UserNum = @[I][B][URL="http://forum.ragezone.com/members/2000256504.html"]mem[/URL][/B][/I]Id/8
        SET @CNT= @CNT+27
    END
END
 
Upvote 0
Banned
Banned
Joined
Jul 14, 2020
Messages
420
Reaction score
35
ELSE 0 --Default - 0 eCoins <<<< what is this for? if dungeon is not finished doesn't give ecoin or do I need to remove this so the function above will work?
 
Upvote 0
RaGEZONE VIP
[VIP] Member
Joined
Oct 10, 2019
Messages
198
Reaction score
455
ELSE 0 --Default - 0 eCoins <<<< what is this for? if dungeon is not finished doesn't give ecoin or do I need to remove this so the function above will work?
If a dungeon is not on your list, no reward will be issued. For example, you want to reward for finishing B3F, but do not want to reward for finishing SoD. If the SoD ID is not in the list, the default setting (0 eCoins) will work.
 
Upvote 0
Newbie Spellweaver
Joined
Sep 10, 2020
Messages
24
Reaction score
7
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.

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



Code:
DECLARE [B]@ecoin[/B] int    
        
    SELECT [B]@ecoin[/B] = ecoin
    FROM cabal_DungeonEcoin_Table
    WHERE DungeonIdx = [USER=2000255614]dung[/USER]eonIdx
        
    SET @CNT = 1
    WHILE @CNT < DATALENGTH ( [USER=2000256504]mem[/USER]berData )
        BEGIN
            SET [USER=2000256504]mem[/USER]Id = dbo.BinToInt(SUBSTRING ( [USER=2000256504]mem[/USER]berData,@CNT,4 ))
            UPDATE CabalCash.dbo.CashAccount set Cash = Cash + [B]@ecoin[/B] where UserNum = [USER=2000256504]mem[/USER]Id/8
            SET @CNT= @CNT+27
        END
 
Last edited:
Upvote 0
Banned
Banned
Joined
Jul 14, 2020
Messages
420
Reaction score
35
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
 
Upvote 0
Newbie Spellweaver
Joined
Sep 10, 2020
Messages
24
Reaction score
7
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
DungeonIdxecoin
293
50
4353
150

293 is for Volcanic Citadel
4353 id for Ancient Tomb

I hope you get the idea.
 
Upvote 0
Banned
Banned
Joined
Jul 14, 2020
Messages
420
Reaction score
35
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
DungeonIdxecoin
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?
 
Upvote 0
Banned
Banned
Joined
Jul 14, 2020
Messages
420
Reaction score
35
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.
 
Upvote 0
Back
Top