Premium Item Cash shop

Results 1 to 2 of 2
  1. #1
    Apprentice ippo20 is offline
    MemberRank
    Nov 2010 Join Date
    17Posts

    Premium Item Cash shop

    Help, I know how to put Cash Items in cash shop using sir chumpys web shop. hexed the CabalMain also following the instructions. But how can I put an "ITEM(PREMIUM)", that when bought, will make an account premium with expiry.

    Thanks.


  2. #2
    The Dinosaur chumpywumpy is offline
    MemberRank
    Jun 2008 Join Date
    /f451/Location
    5,127Posts

    Re: Premium Item Cash shop

    The cash shop isn't really set up to do this but you can mod the database to do it.

    Look in my xmas gift box in my sig for the infinite auto premium.

    Code:
    	SELECT @rType=Type, 
    		 @rExpireDate=ExpireDate, 
    		 @rPayMinutes=PayMinutes,
    		 @rServiceKind=ServiceKind
    		 FROM cabal_charge_auth WHERE usernum = @rusernum
    	IF @@ROWCOUNT = 0
    	BEGIN
            -- Set default premium data for new accounts here
    		SET @rType = 1
    		SET @rServiceKind = 1
            SET @rExpireDate = dateadd(year,+1,getdate())
    		SET @rPayMinutes = 0
    		insert into cabal_charge_auth
    		(UserNum, [Type], [ExpireDate], PayMinutes, ServiceKind)
    		values
    		(@rusernum, @rType, @rExpireDate, @rPayMinutes, @rServiceKind)
    	END
      ELSE -- update existing premium
    		update cabal_charge_auth set [ExpireDate]=dateadd(year,+1,getdate()) where UserNum=@rusernum
    The bit in red adds 1 year to the user's premium and either updates what is there already or adds them as a new premium user if not (using the default type and servicekind noted).

    You need to edit up_UseMyCashItem in the cabalcash database to add the code above (remember to take backups!) and modify it a bit.

    Code:
    	SELECT 	@IsUse = IsUse,
    		@ItemKindIdx = ItemKindIdx,
    		@ItemOpt = ItemOpt, 
    		@DurationIdx = DurationIdx
    	FROM MyCashItem WHERE Id = @Id
    	IF( @@ROWCOUNT > 0 AND @IsUse = 0 )
    	BEGIN
    		UPDATE MyCashItem SET IsUse = 1, UseDate = GetDate() WHERE Id = @Id AND IsUse = 0
    		SET @Result = 0
    	END
    This bit of the stored procedure gets the itemkind and itemopt (and whether the item has already been used). If it has not been used the bit in red is executed. Your modified copy of the top bit of code needs to check for the item type/itemopt of your blessing bead or whatever and then either insert new premium or update an existing one. This edited code should be pasted between the red line and "SET @Result = 0"

    It might take a bit of fiddling but the quotes above already have all of the bits of code you need to make the edits if you have at least a little SQL knowledge.

    Note: the first bit of code uses @rusernum or the user number and the second uses @usernum!

    There is probably an easier way but I can't think of one right now.



Advertisement