Database fix for buying 0 bounty items

Results 1 to 9 of 9
  1. #1
    In Progress... FFXIV... Anju is offline
    MemberRank
    Oct 2010 Join Date
    Mist Ward 7 #38Location
    1,946Posts

    Database fix for buying 0 bounty items

    To fix that stupid error message that say you can't buy anything with that is 0 bounty when you have no bounty, you would need to make the database stored procedures table do something. If those already knew about this, good for you, pricks. Thanks for not sharing. If this doesn't work for you, all I know is that it is the sources.

    Code:
    USE [GunzDB]
    GO
    /****** Object:  StoredProcedure [dbo].[spBuyBountyItem]    Script Date: 1/10/2013 3:36:39 AM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROC [dbo].[spBuyBountyItem]
    -- ALTER PROC dbo.spBuyBountyItem
    	@CID				INT,  
    	@ItemID				INT,
    	@ItemCount			INT,
    	@Price				INT,
    	@IsSpendableItem	INT,
    	@RentHourPeriod		INT = NULL	
    AS BEGIN
    	SET NOCOUNT ON
    	
    	DECLARE @Bounty INT;
    	DECLARE @OrderCIID INT;
    	DECLARE @Cnt INT;
    	
    	IF( @RentHourPeriod IS NULL ) BEGIN
    		SET @RentHourPeriod = 0;
    	END
    	
    	DECLARE @CurDate DATETIME;
    	SET @CurDate = GETDATE();
    
    	BEGIN TRAN ----------------------------	
    	
    		-- Àܾװ˻ç => Bounty °¨¼Ò      
    		UPDATE	dbo.Character 
    		SET		BP = BP - @Price 
    		WHERE	CID = @CID 
    		AND		(BP - @Price > 0);
    		
    		IF( 0 <> @@ERROR OR 0 = @@ROWCOUNT ) BEGIN      
    			ROLLBACK TRAN
    			SELECT -1 AS 'Ret'
    			RETURN;
    		END      		
    		
    		IF( @IsSpendableItem = 1 ) BEGIN
    					
    			-- ÀÌ¹Ì °®°í ÀÖ´ÂÁö È®ÀÎÇØº»´Ù.
    			SELECT	@OrderCIID = CIID 
    			FROM	CharacterItem(NOLOCK) 
    			WHERE	CID = @CID 
    			AND		ItemID = @ItemID;
    		
    			-- ÀÌ¹Ì °®°í ÀÖÁö ¾Ê´Ù¸é »õ·Î Ãß°¡ÇØÁØ´Ù.
    			IF( @OrderCIID IS NOT NULL ) BEGIN
    			
    				UPDATE	dbo.CharacterItem				-- Item Ãß°¡
    				SET		Cnt = Cnt + @ItemCount
    				WHERE	CIID = @OrderCIID
    				AND		CID = @CID;
    				
    				IF( 0 <> @@ERROR OR 0 = @@ROWCOUNT ) BEGIN      
    					ROLLBACK TRAN
    					SELECT -2 AS 'Ret'
    					RETURN;
    				END
    										
    			END ELSE BEGIN
    			
    				INSERT INTO CharacterItem (CID, ItemID, RegDate, RentDate, RentHourPeriod, Cnt)
    				Values (@CID, @ItemID, @CurDate, @CurDate, @RentHourPeriod, @ItemCount)
    				
    				IF( 0 <> @@ERROR OR 0 = @@ROWCOUNT ) BEGIN      
    					ROLLBACK TRAN
    					SELECT -3 AS 'Ret'
    					RETURN;
    				END
    				
    				SELECT @OrderCIID = @@IDENTITY;	
    			END
    						
    		END
    		ELSE BEGIN
    				
    			INSERT dbo.CharacterItem (CID, ItemID, RegDate, RentDate, RentHourPeriod, Cnt)
    			Values (@CID, @ItemID, @CurDate, @CurDate, @RentHourPeriod, @ItemCount)
    			
    			SELECT @OrderCIID = @@IDENTITY;	
    			
    			IF( 0 <> @@ERROR OR 0 = @@ROWCOUNT ) BEGIN      
    				ROLLBACK TRAN
    				SELECT -4 AS 'Ret'
    				RETURN;
    			END
    						
    		END 
    		
    		-- Item ±¸¸Å·Î±× Ãß°¡      
    		INSERT INTO ItemPurchaseLogByBounty (ItemID, CID, Date, Bounty, CharBounty, Type)
    		VALUES (@ItemID, @CID, @CurDate, @Price, @Bounty, '±¸ÀÔ')
    		
    		IF( 0 <> @@ERROR OR 0 = @@ROWCOUNT ) BEGIN      
    			ROLLBACK TRAN
    			SELECT -5 AS 'Ret'
    			RETURN;
    		END
    		
    	COMMIT TRAN ----------------------------
    		
    	SELECT 0 AS 'Ret', @OrderCIID AS 'ORDERCIID'
    END
    
    
    ----------------------------------------------------------------------------------------------------------------------------------------
    -- º¹±¸ Äõ¸®
    /*
    DROP PROC spBuyBountyItem
    EXEC sp_rename 'BackUp_spBuyBountyItem', 'spBuyBountyItem'
    */
    You would have this in your dbo.spBuyBountyItem
    Go to the part where it says "(BP - @Price > 0)" and add a "=" after the ">"
    Show it should look something like this:

    Code:
    USE [GunzDB]
    GO
    /****** Object:  StoredProcedure [dbo].[spBuyBountyItem]    Script Date: 1/10/2013 3:36:39 AM ******/
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    ALTER PROC [dbo].[spBuyBountyItem]
    -- ALTER PROC dbo.spBuyBountyItem
    	@CID				INT,  
    	@ItemID				INT,
    	@ItemCount			INT,
    	@Price				INT,
    	@IsSpendableItem	INT,
    	@RentHourPeriod		INT = NULL	
    AS BEGIN
    	SET NOCOUNT ON
    	
    	DECLARE @Bounty INT;
    	DECLARE @OrderCIID INT;
    	DECLARE @Cnt INT;
    	
    	IF( @RentHourPeriod IS NULL ) BEGIN
    		SET @RentHourPeriod = 0;
    	END
    	
    	DECLARE @CurDate DATETIME;
    	SET @CurDate = GETDATE();
    
    	BEGIN TRAN ----------------------------	
    	
    		-- Àܾװ˻ç => Bounty °¨¼Ò      
    		UPDATE	dbo.Character 
    		SET		BP = BP - @Price 
    		WHERE	CID = @CID 
    		AND		(BP - @Price >= 0);
    		
    		IF( 0 <> @@ERROR OR 0 = @@ROWCOUNT ) BEGIN      
    			ROLLBACK TRAN
    			SELECT -1 AS 'Ret'
    			RETURN;
    		END      		
    		
    		IF( @IsSpendableItem = 1 ) BEGIN
    					
    			-- ÀÌ¹Ì °®°í ÀÖ´ÂÁö È®ÀÎÇØº»´Ù.
    			SELECT	@OrderCIID = CIID 
    			FROM	CharacterItem(NOLOCK) 
    			WHERE	CID = @CID 
    			AND		ItemID = @ItemID;
    		
    			-- ÀÌ¹Ì °®°í ÀÖÁö ¾Ê´Ù¸é »õ·Î Ãß°¡ÇØÁØ´Ù.
    			IF( @OrderCIID IS NOT NULL ) BEGIN
    			
    				UPDATE	dbo.CharacterItem				-- Item Ãß°¡
    				SET		Cnt = Cnt + @ItemCount
    				WHERE	CIID = @OrderCIID
    				AND		CID = @CID;
    				
    				IF( 0 <> @@ERROR OR 0 = @@ROWCOUNT ) BEGIN      
    					ROLLBACK TRAN
    					SELECT -2 AS 'Ret'
    					RETURN;
    				END
    										
    			END ELSE BEGIN
    			
    				INSERT INTO CharacterItem (CID, ItemID, RegDate, RentDate, RentHourPeriod, Cnt)
    				Values (@CID, @ItemID, @CurDate, @CurDate, @RentHourPeriod, @ItemCount)
    				
    				IF( 0 <> @@ERROR OR 0 = @@ROWCOUNT ) BEGIN      
    					ROLLBACK TRAN
    					SELECT -3 AS 'Ret'
    					RETURN;
    				END
    				
    				SELECT @OrderCIID = @@IDENTITY;	
    			END
    						
    		END
    		ELSE BEGIN
    				
    			INSERT dbo.CharacterItem (CID, ItemID, RegDate, RentDate, RentHourPeriod, Cnt)
    			Values (@CID, @ItemID, @CurDate, @CurDate, @RentHourPeriod, @ItemCount)
    			
    			SELECT @OrderCIID = @@IDENTITY;	
    			
    			IF( 0 <> @@ERROR OR 0 = @@ROWCOUNT ) BEGIN      
    				ROLLBACK TRAN
    				SELECT -4 AS 'Ret'
    				RETURN;
    			END
    						
    		END 
    		
    		-- Item ±¸¸Å·Î±× Ãß°¡      
    		INSERT INTO ItemPurchaseLogByBounty (ItemID, CID, Date, Bounty, CharBounty, Type)
    		VALUES (@ItemID, @CID, @CurDate, @Price, @Bounty, '±¸ÀÔ')
    		
    		IF( 0 <> @@ERROR OR 0 = @@ROWCOUNT ) BEGIN      
    			ROLLBACK TRAN
    			SELECT -5 AS 'Ret'
    			RETURN;
    		END
    		
    	COMMIT TRAN ----------------------------
    		
    	SELECT 0 AS 'Ret', @OrderCIID AS 'ORDERCIID'
    END
    
    
    ----------------------------------------------------------------------------------------------------------------------------------------
    -- º¹±¸ Äõ¸®
    /*
    DROP PROC spBuyBountyItem
    EXEC sp_rename 'BackUp_spBuyBountyItem', 'spBuyBountyItem'
    */
    Credits
    • Me - Figuring it out with a test client


    Note: It can be either the database or the source files that doesn't allow you to buy 0 bounty items when you have no bounty. Also this is for those who uses a non-edited dbo.spBuyBountyItem, not dbo.spBuyBountyItem2.


  2. #2
    Apprentice s p a r k z is offline
    MemberRank
    Dec 2012 Join Date
    12Posts

    Re: Database fix for buying 0 bounty items

    works for me ty tai. :)

  3. #3
    DRGunZ 2 Creator wesman2232 is offline
    MemberRank
    Jan 2007 Join Date
    Erie, PALocation
    4,872Posts

    Re: Database fix for buying 0 bounty items

    I'll have to see if this works once I can get access to our vps again.

  4. #4
    In Progress... FFXIV... Anju is offline
    MemberRank
    Oct 2010 Join Date
    Mist Ward 7 #38Location
    1,946Posts

    Re: Database fix for buying 0 bounty items

    Just depends on your source as well. I noticed when I used an old runnable of Gunz 1.5 and tested it ingame, it wasn't working when buying the 0 bounty items. Later I tested a customized files that I still have for an old server. It wasn't working for the customized runnable. So it depends on the database and source from my guess.

  5. #5
    Enthusiast Lexuse is offline
    MemberRank
    Jan 2013 Join Date
    48Posts

    Re: Database fix for buying 0 bounty items

    This will help beginners Thnx

  6. #6
    Valued Member theprolor is offline
    MemberRank
    Nov 2012 Join Date
    Inside you ;)Location
    134Posts

    Re: Database fix for buying 0 bounty items

    thanks manq

  7. #7
    Apprentice kobix088 is offline
    MemberRank
    Sep 2012 Join Date
    Davao City, PhiLocation
    19Posts

    Re: Database fix for buying 0 bounty items

    Where i can see that??

  8. #8
    Enthusiast Lexuse is offline
    MemberRank
    Jan 2013 Join Date
    48Posts

    Re: Database fix for buying 0 bounty items

    Quote Originally Posted by kobix088 View Post
    Where i can see that??
    dbo.spBuyBountyItem :P

  9. #9
    In Progress... FFXIV... Anju is offline
    MemberRank
    Oct 2010 Join Date
    Mist Ward 7 #38Location
    1,946Posts

    Re: Database fix for buying 0 bounty items

    ^ That as I stated in the OP, lul.



Advertisement